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

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

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)