how can i list all my files how can i list all my files
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

how can i list all my files

Started by superstan, May 29, 2005, 09:11:16 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

superstan

hello

Is there an easy way of listing all my files in the gallery - i tried it with mysql but i dont know how to produce just a single listing of my gallery content
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.planetdarren.co.uk%2Fforums%2Fimages%2Favatars%2Fgallery%2Fdarren%2Fdazboy.gif&hash=bb703a0762c41ae1c1106ea6a153f9165ca94207)

Joachim Müller

#1
Create a file in your coppermine dir, name it "listall.php" or similar with this content:
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2005 Coppermine Dev Team
  v1.1 originaly written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
**********************************************/

define('IN_COPPERMINE'true);


require(
'include/init.inc.php');

if (!
GALLERY_ADMIN_MODE) die('Access denied');

pageheader('All files in my database');

starttable(-2,'All files in my database',4);
print <<< EOT
<tr>
  <td class="tableh1">Picture ID</td>
  <td class="tableh1">Album ID</td>
  <td class="tableh1">File path</td>
  <td class="tableh1">File size</td>
</tr>
EOT;

$result db_query("SELECT pid, aid, filepath, filename, total_filesize  from {$CONFIG['TABLE_PICTURES']} ORDER BY aid");
$rowset db_fetch_rowset($result);
mysql_free_result($result);
$sum_filesize 0;
foreach (
$rowset as $key => $row){
print <<< EOT
<tr>
  <td class="tableb_compact">
{$row['pid']}</td>
  <td class="tableb_compact">
{$row['aid']}</td>
  <td class="tableb_compact">
{$row['filepath']}{$row['filename']}</td>
  <td class="tableb_compact" align="right">
{$row['total_filesize']} Bytes</td>
</tr>
EOT;

$sum_filesize $sum_filesize $row['total_filesize'];
}
$sum_filesize floor($sum_filesize/1000);
print <<< EOT
<tr>
  <td class="tablef">Sum</td>
  <td class="tablef"></td>
  <td class="tablef"></td>
  <td class="tablef" align="right">
$sum_filesize KB</td>
</tr>
EOT;

endtable();
pagefooter();
ob_end_flush();
?>
upload it and run it in your browser.

superstan

thank you for your prompt reply  ;D
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.planetdarren.co.uk%2Fforums%2Fimages%2Favatars%2Fgallery%2Fdarren%2Fdazboy.gif&hash=bb703a0762c41ae1c1106ea6a153f9165ca94207)