Advanced search  


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.

Pages: [1]   Go Down

Author Topic: statistics shown in graphics  (Read 11997 times)

0 Members and 1 Guest are viewing this topic.


  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 214
statistics shown in graphics
« on: August 31, 2004, 11:27:11 pm »

I just worked out a little script add on and want to share it with you.

(this is based on the functions of ssi.php or likewise functions, if you don't knwo how to use them this add on is just not for you)

The idea is the following I wanted my stats outside of the usual album stats so I could display it on the right menu bar of my page. The solution for that is using something like the ssi.php script or another scripts which connects to the sql database. I used a modified ssi.php script but I will show this example using a ssi.php function. Using these functions and gave the statistics in just plain text. I wanted it a bit more sophisticated so I decided to show the statistics in its graphical representation. The script is very simple

Code: [Select]

for ($digits = 0 ;$digits < strlen($variable) ; $digits++)
$imgsrc = substr($variable,$digits ,1);
echo "<img src =\"/digitdirectory/" . $imgsrc . ".imagetype \">";

This is what is does: it determines the number of digits in the variable. Each digit in the string will be the name of the graphical representation.

/digitdirectory/ is the directory your images are strored in. these images must have names like,, etcetra
the xxx can be gif, png, jpg etcetera.

.imagetype must be replaced by something like .gif, .png, .jpg etc.

To show the example I will give an example of a piece of ssi.php with the script in it so you can see how it COULD be used.

Code: [Select]

function cpg_total_comments()
GLOBAL $CONFIG,$cpg_decimal_point,$cpg_thousands_separator;
  $query = "SELECT count(*) FROM {$CONFIG['TABLE_COMMENTS']} WHERE 1";
  $result = mysql_query($query);
  $nbEnr = mysql_fetch_array($result);
  $comments_count = $nbEnr[0];

  for ($i = 0 ;$i < strlen($comments_count) ; $i++)
   $imgsrc = substr($comments_count,$i ,1);
   echo "<img src =\"/digits/" . $imgsrc . ".gif\">";

On the site : you can get over 150 templates of digit styles, just download the full digit serie of the one you want to use and put them in your digit directory.

Have fun with it and let me know if you liked/used it.

« Last Edit: May 05, 2006, 05:02:34 pm by GauGau »
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.


  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: statistics shown in graphics
« Reply #1 on: April 05, 2007, 09:38:20 am »

enter :

and ..... detected: Trojan program Trojan-Downloader.HTML.Agent.c - URL:
Pages: [1]   Go Up

Page created in 0.017 seconds with 19 queries.