Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Showing Diskspace used  (Read 2693 times)

0 Members and 1 Guest are viewing this topic.

keiler83

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Showing Diskspace used
« on: June 27, 2005, 12:13:05 pm »

Hey guys!

Im trying to put a line into the nav-sidebar of my gallery, which says how much diskspace all albums (gallery uses $totaldirectorysize Kilobyte) use, but according to my new topic here unsuccessful. Does anyone of you know how to get that to work?

I've already tried to do it with some of the code that is used in each profile (disk quota), but never got it right.

Thanks in advance.

edit:

Im almost done with that, just need a lil bit help to finish it:
ive created a space.php in the directory albums with this content:

Code: [Select]
<?
   function readsize_recursiv($path)
   {
      $s = 0;
      $result[$path] = 0;
      $handle = opendir($path);
      if ($handle)
      {
         while (false !== ($file = readdir($handle)))
         {
             if ($file != "." && $file != "..")
             {
                $name = $path . "/" . $file;
                if (is_dir($name))
                {
                   $ar = readsize_recursiv($name);
                   while (list($key, $value) = each ($ar))
                   {
                      $s++;
                      $result[$key] = $value;
                   }
                }
                else
                {
                   $result[$path] += filesize($name);
                }
             }
         }
      }
      closedir($handle);
      return $result;
   }
   $data = readsize_recursiv(".");
   $summe = 0;
   while (list($key, $value) = each ($data))
   {
     
     $summe += ($value / (1048576));
     round($summe, 2);
   }
   
  echo "Size:<br>",
        round($summe, 2);
  echo " MB";
?>

If you open that file from that directory, it shows the disk space used in that directory and all subdirectories. Fine, that works finally.
But how do i include that on the main site?

include function in theme.php doesnt work...it wont show any of the "echo" content
ive already got a custom header and im not sure if i can have a second one. plus, i think that script needs to be run directly from the albums directory

Any ideas?


last edit: SOLVED...found out how to do that...


Greets KEiLER
« Last Edit: June 30, 2005, 04:34:50 am by GauGau »
Logged

Sebbit

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 25
    • PITA - stunt page
How to include my space.php to the gallery statistic?
« Reply #1 on: October 17, 2005, 06:56:12 pm »

Hallo!

I want to include THIS space.php file to my gallery statistic standing above all the albums ("xxx pictures in xxx albums" etc.), so that i have the text "xxx pictures in xxx albums, (...), with a total size of xxx MB"

How can I realize that?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Showing Diskspace used
« Reply #2 on: October 17, 2005, 09:18:02 pm »

merged your thread with the one you're refering to.
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 17 queries.