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] 2 3 4 5   Go Down

Author Topic: [Done] statistics as an image - have a look  (Read 79626 times)

0 Members and 1 Guest are viewing this topic.

Bruz

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 54
[Done] statistics as an image - have a look
« on: March 01, 2004, 11:24:45 am »

It's hard for me do describe in the topic what this mod is exactly about - just have a look!

Hi!

I had the idea to crate an image which contains the statistics of my coppermine-album.
The really best thing would be, I've thought, if it's possible to show on the very left a random picture and right beside it some informations about my album:
[list=1]The album name
total pictures
total comments
total viewed[/list:o]
« Last Edit: February 14, 2005, 06:41:47 am by GauGau »
Logged
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.kingbruz.de%2FFotos%2Fsignatur_cpg.php&hash=0e1b702f24041a95544ac67a72041198)

get your statistik-hack here

Bruz

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 54
[Done] statistics as an image - have a look
« Reply #1 on: March 01, 2004, 11:57:39 am »

I've thought of ssi.php and used it - thanks to the developer!


And thats what it finally looks like:
----
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.kingbruz.de%2FFotos%2Fsignatur_cpg.php&hash=0e1b702f24041a95544ac67a72041198)
----

EDIT:
If anybody is interested in this mod, please tell me. I've rewritten it completely as you see above - now it creates even a full-color-image!
Logged
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.kingbruz.de%2FFotos%2Fsignatur_cpg.php&hash=0e1b702f24041a95544ac67a72041198)

get your statistik-hack here

sourabh

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
[Done] statistics as an image - have a look
« Reply #2 on: March 02, 2004, 02:31:30 am »

I am interested :)
Logged

Bruz

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 54
[Done] statistics as an image - have a look
« Reply #3 on: March 02, 2004, 07:04:35 am »

And here's the mod:                        [last updated: 07.03.2004]

First, get you a copy of the ssi.php which is contained in this file:
http://prdownloads.sourceforge.net/coppermine/cpg1.1mod_ssi.zip?download

Rename the ssi.php to signature_cgp.php and store it in your coppermine-root-dir.

Open signature_cpg.php

find:
Code: [Select]
/////////////////// edit the following lines //////////////////////////////

edit the following lines to match your album / your language (you don't really need to fill in your language, it's not needet for this mod)

find
Code: [Select]
print <<<EOT
till
Code: [Select]
EOT;
(lines 34-40)
and delete it.

find
Code: [Select]
$return_value.= "<img src=\"".$url_of_cpg_dir.$cpg_album_path.$row['filepath'].$cpg_thumb_pfx.$row['filename']."\" border=\"0\" alt=\"\" title=\"";

replace with
Code: [Select]
$return_value.= "".$url_of_cpg_dir.$cpg_album_path.$row[rawurlencode('filepath')].rawurlencode($cpg_thumb_pfx.$row['filename']);

delete the following 8 Lines ("if ($row['title']!="")" till "$return_value.=$td_end."\n";")

find
Code: [Select]
function cpg_random()
{
return cpg_thumb(1,1,1,"",1);
}


after, add
Code: [Select]
function random_picture()
{
return cpg_thumb(0,0,1,"",1);
}


find
Code: [Select]
//function taken from functions.inc.php
function db_connect()
{
        global $CONFIG;
        $result = @mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']);
        if (!$result)
                return false;
        if (!mysql_select_db($CONFIG['dbname']))
                return false;
        return $result;
}


after, add
Code: [Select]
$total_pics = cpg_total_pics("");
$total_albums = cpg_total_albums();
$total_comments = cpg_total_comments();
$total_views = cpg_total_views("");
$random_picture = random_picture();

$im = ImageCreateTrueColor (375, 75);
$bgc = ImageColorAllocate ($im, 255, 255, 255);
$farbe_text = ImageColorAllocate ($im, 0, 0, 132);
$farbe_online = ImageColorAllocate ($im, 255, 0, 0);
$tc = ImageColorAllocate ($im, 3, 5, 17);
ImageFilledRectangle ($im, 0, 0, 375, 75 ,$bgc);
ImageString($im, 3, 105, 7, "Statistics of [your album-name here]", $farbe_text);
ImageString($im, 2, 105, 20, "$total_pics Pictures", $tc);
ImageString($im, 2, 105, 30, "$total_albums Albums", $tc);
ImageString($im, 2, 105, 40, "$total_comments Comments", $tc);
ImageString($im, 2, 105, 50, "viewed $total_views times", $tc);

imagecolortransparent($im, $bgc);

$background = $im ;
$insert = imagecreatefromjpeg($random_picture);

imagecolortransparent($insert, imagecolorexact($insert,255,0,255));

$insert_x = imagesx($insert);
$insert_y = imagesy($insert);

imagecopymerge($background,$insert,0,0,0,0,$insert_x,$insert_y,100);

header("Content-Type: image/png");
imagepng($background,"",100);
ImageDestroy ($im);


save the file.

Now you can add the statistic-image with
Code: [Select]
[img]http://yourdomain/your-path-to-coppermine/signature_cpg.php[/img]
or with the HTML equivalents.

You're done!
Logged
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.kingbruz.de%2FFotos%2Fsignatur_cpg.php&hash=0e1b702f24041a95544ac67a72041198)

get your statistik-hack here

MaThIbUs

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 130
  • I rock.
    • http://mathibus.com/
[Done] statistics as an image - have a look
« Reply #4 on: March 03, 2004, 02:20:23 pm »

Looks cool. Is there a way to change the font?
Logged

Nibbler

  • Guest
[Done] statistics as an image - have a look
« Reply #5 on: March 03, 2004, 02:43:10 pm »

Font is the second parameter to the ImageString function. You can use 1 to 5 to select from the built-in fonts.
Logged

Bruz

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 54
What does your image looks like?
« Reply #6 on: March 06, 2004, 06:13:57 pm »

THX for your answer, Nibbler!

I'm interested in what your statistics-image looks like - would be nice, if every user who is unsing this hack could post his image!
Logged
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.kingbruz.de%2FFotos%2Fsignatur_cpg.php&hash=0e1b702f24041a95544ac67a72041198)

get your statistik-hack here

thoth

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
[Done] statistics as an image - have a look
« Reply #7 on: March 06, 2004, 07:14:10 pm »

wish i could show it to you, but unfortunately there's a problem:

http://fotografie.meewezen.nl:8080/coppermine/signature_cgp.php

running W2k3, apache. there also seems to be a problem with this line:

Quote
$return_value.= "".$url_of_cpg_dir.$cpg_album_path.$row['filepath'].rawurlencode($cpg_thumb_pfx.$row['filename']);


which i could not find in the downloaded ssi.php  :(  (other version?)
i deleted the 8 lines following a line that was similar.

please help, b/c i would love to use this hack.
Logged
Thanks to Bruz for Sig!
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Ffotos.meewezen.nl%2Fsignature_cpg.php&hash=b0556e01af6a0786a6d3699f2acb1b7a)

Bruz

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 54
[Done] statistics as an image - have a look
« Reply #8 on: March 06, 2004, 08:31:27 pm »

I'm sorry - you're right!

Instead, look for
Code: [Select]
$return_value.= "<img src=\"".$url_of_cpg_dir.$cpg_album_path.$row['filepath'].$cpg_thumb_pfx.$row['filename']."\" border=\"0\" alt=\"\" title=\"";

and replace with:
Code: [Select]
$return_value.= "".$url_of_cpg_dir.$cpg_album_path.$row['filepath'].rawurlencode($cpg_thumb_pfx.$row['filename']);
and delete the following 8 lines - this lines are:
Code: [Select]
if ($row['title']!="") {$return_value.= $row['title']." ";}
if ($row['caption']!="") {$return_value.= $row['caption']." ";}
if ($row['keywords']!="") {$return_value.= $cpg_lang_keywords . ": " . $row['keywords']." ";}
if ($row['hits']!="") {$return_value.= $row['hits']." ".$cpg_lang_views." ";}
if($cpg_random=="1")  {$return_value.= $cpg_lang_random;}
$return_value.= "\" align=\"left\" class=\"padright\">";
if ($cpg_include_link==1){$return_value.="</a>";}
$return_value.=$td_end."\n";


I have corrected the line in my post above - thanks thoth!
Logged
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.kingbruz.de%2FFotos%2Fsignatur_cpg.php&hash=0e1b702f24041a95544ac67a72041198)

get your statistik-hack here

thoth

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
[Done] statistics as an image - have a look
« Reply #9 on: March 06, 2004, 10:59:09 pm »

thanks Bruz this is great!!

(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Ffotos.meewezen.nl%2Fsignature_cpg.php&hash=b0556e01af6a0786a6d3699f2acb1b7a)
Logged
Thanks to Bruz for Sig!
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Ffotos.meewezen.nl%2Fsignature_cpg.php&hash=b0556e01af6a0786a6d3699f2acb1b7a)

Bruz

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 54
[Done] statistics as an image - have a look
« Reply #10 on: March 13, 2004, 03:43:45 pm »

I've done some researches on it, but without succsess..
I'd like to have the background of the image transparent, but the commands seems not to work correctly with 'ImageCreateTrueColor'

Anybody able to fix this?
Logged
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.kingbruz.de%2FFotos%2Fsignatur_cpg.php&hash=0e1b702f24041a95544ac67a72041198)

get your statistik-hack here

christian

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 16
    • Aalborg Kunstpavillon (Art Gallery)
[Done] statistics as an image - have a look
« Reply #11 on: March 19, 2004, 08:55:23 pm »

Quote from: "Bruz"
Now you can add the statistic-image with
Code: [Select]
http://yourdomain/your-path-to-coppermine/signature_cpg.php or with the HTML equivalents.


What is the equivalent HTML code? I have tried different versions without any result. Please help - I would like to implement this genious mod on our site  8)

Thanks,
Christian
Logged

Rodinou

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 346
  • Tournicoti, Tournicota
    • http://www.sortons.net
[Done] statistics as an image - have a look
« Reply #12 on: March 19, 2004, 11:29:17 pm »

Test :)

(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.sortons.net%2Fphotos%2Fsignature_cpg.php&hash=654cd678198005b487382e1bfdac4335)


Ok ... don't work for me : what a pity :)

christian

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 16
    • Aalborg Kunstpavillon (Art Gallery)
Found a solution
« Reply #13 on: March 19, 2004, 11:38:10 pm »

I did find a solution:  
Code: [Select]
<img src="http://www.site.url/path/file.php">

Thanks again, Christian
Logged

turtleboy

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 36
    • SkylineDesigns
[Done] statistics as an image - have a look
« Reply #14 on: April 06, 2004, 03:10:54 am »

(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fskylinedesigns.net%2Ffoto%2Ffoto-gallery%2Fsignature_cgp.php&hash=d257ac2d21cfb868b6396e5bd38e8989)

uhh.. I kinda got it to work.. what am I doing wrong?

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
[Done] statistics as an image - have a look
« Reply #15 on: April 06, 2004, 08:32:24 am »

hard to say without a link and your actual code... :(

GauGau
Logged

Frank

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
[Done] statistics as an image - have a look
« Reply #16 on: April 06, 2004, 04:56:31 pm »

Could you post the full source, with modifications done in the ssi file? It would be helpful for everyone, instead of having to modify ssi.php ourselves.

Thanks, Frank
Logged

Bruz

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 54
[Done] statistics as an image - have a look
« Reply #17 on: April 09, 2004, 02:21:18 pm »

Quote from: "Frank"
Could you post the full source, with modifications done in the ssi file? It would be helpful for everyone, instead of having to modify ssi.php ourselves.

Thanks, Frank


Sure, but you have to do some modifications - or it will show the stats of my gallery ;)
So, change the lines after
Code: [Select]
/////////////////// edit the following lines ////////////////////////////// to match your settings!

@ php-coders: I think it is possible to delete some stuff out of the orginal ssi.php - this would make the file smaller.

You will need to put this code in a new file called 'signatur.php' (or something else) and put it in your coppermine-root-dir.

Code: [Select]

<?php
// ------------------------------------------------------------------------- //
//  include script for CPG &#40;c&#41; 2003 GauGau &#40;mail@gaugau.de&#41; V1.4             //
//  http&#58;//gaugau.de/   changed by Bruz                                                     //
// ------------------------------------------------------------------------- //
//  Coppermine Photo Gallery v1.1                                     //
// ------------------------------------------------------------------------- //
//  Copyright &#40;C&#41; 2002,2003  Gr&eacute;gory DEMAR <gdemar@wanadoo.fr>               //
//  http&#58;//www.chezgreg.net/coppermine/                                      //
// ------------------------------------------------------------------------- //
//  Based on PHPhotoalbum by Henning Støverud <henning@stoverud.com>         //
//  http&#58;//www.stoverud.com/PHPhotoalbum/                                    //
// ------------------------------------------------------------------------- //
//  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        //
//  &#40;at your option&#41; any later version.                                      //
// ------------------------------------------------------------------------- //

/////////////////// edit the following lines //////////////////////////////
$url_of_cpg_dir='http&#58;//www.yourpath';    // full path to your coppermine gallery &#40;with trailing slash&#41;
$absolute_path_to_coppermine='/yourpath/'// absolute path on your server to coppermine gallery &#40;with trailing slash&#41;
// to find more about absolute paths, check http&#58;//www.php.net/manual/en/function.phpinfo.php and look for 'DOCUMENT_ROOT' in your phpinfo.php
$cpg_decimal_point=","//what character is used to separate decimals in your country, e.g. in Germany ",", in GB "."
$cpg_thousands_separator="."//what character is used to separate thousands in your country, e.g. in Germany ".", in GB & US ",", in France " "
$cpg_lang_pics "Bilder"//translate this
$cpg_lang_views "mal angesehen"//translate this
$cpg_lang_random "Zufallsbild"//translate this
$cpg_lang_keywords "Keywords"//translate this
/////// don't edit below this line unless you know what your're doing /////////

include_once&#40; $absolute_path_to_coppermine.'/include/config.inc.php'&#41;;

// definition taken from init.inc.php
$CONFIG['TABLE_PICTURES'&#93;        = $CONFIG['TABLE_PREFIX'&#93;."pictures";
$CONFIG['TABLE_ALBUMS'&#93;                = $CONFIG['TABLE_PREFIX'&#93;."albums";
$CONFIG['TABLE_COMMENTS'&#93;        = $CONFIG['TABLE_PREFIX'&#93;."comments";
$CONFIG['TABLE_CATEGORIES'&#93;        = $CONFIG['TABLE_PREFIX'&#93;."categories";
$CONFIG['TABLE_CONFIG'&#93;                = $CONFIG['TABLE_PREFIX'&#93;."config";
$CONFIG['TABLE_USERGROUPS'&#93;        = $CONFIG['TABLE_PREFIX'&#93;."usergroups";
$CONFIG['TABLE_VOTES'&#93;                = $CONFIG['TABLE_PREFIX'&#93;."votes";
$CONFIG['TABLE_USERS'&#93;                = $CONFIG['TABLE_PREFIX'&#93;."users";
// Connect to database
db_connect&#40;&#41; || die&#40;"<b>Coppermine critical error</b>&#58;<br />Unable to connect to database !<br /><br />MySQL said&#58; <b>".mysql_error&#40;&#41;."</b>"&#41;;

// get config data
$result mysql_query&#40;"SELECT * from &#123;$CONFIG['TABLE_CONFIG'&#93;&#125; WHERE name='fullpath'"&#41;;
$row mysql_fetch_row&#40;$result&#41;;
$cpg_album_path=$row[1&#93;;
$result mysql_query&#40;"SELECT * from &#123;$CONFIG['TABLE_CONFIG'&#93;&#125; WHERE name='thumb_pfx'"&#41;;
$row mysql_fetch_row&#40;$result&#41;;
$cpg_thumb_pfx=$row['1'&#93;;
$result mysql_query&#40;"SELECT * from &#123;$CONFIG['TABLE_CONFIG'&#93;&#125; WHERE name='thumbcols'"&#41;;
$row mysql_fetch_row&#40;$result&#41;;
$cpg_thumbcols=$row['1'&#93;;


if &#40;$function == 'cpg_thumb' || $function == 'recentTopics' || $function == 'whosOnline' || $function == 'welcome' || $function == 'menubar' || $function == 'logout' || $function == 'login' || $function == 'topBoards' || $function == 'topTopicsViews' || $function == 'topTopicsReplies' || $function == 'latestMember' || $function == 'boardStats'&#41;
&#123;
        
$function&#40;&#41;; // Execute Function
        
exit;
&
#125;

function cpg_thumb&#40;&#41;
&#123;
GLOBAL $CONFIG,$url_of_cpg_dir,$cpg_album_path,$cpg_thumb_pfx,$cpg_thumbcols,$cpg_lang_random,$cpg_lang_views,$cpg_lang_keywords;
$numargs func_num_args&#40;&#41;;
$arg_list func_get_args&#40;&#41;;
if &#40;$numargs > 0&#41; &#123;$cpg_include_link=$arg_list[0&#93;;&#125;
if &#40;$numargs > 1&#41; &#123;$cpg_link_singlepic=$arg_list[1&#93;;&#125;
if &#40;$numargs > 2&#41; &#123;$cpg_how_many=$arg_list[2&#93;;&#125;
if &#40;$numargs > 3&#41; &#123;$cgp_limit_album=$arg_list[3&#93;;&#125;
if &#40;$numargs > 4&#41; &#123;$cpg_random=$arg_list[4&#93;;&#125;
if &#40;$numargs > 5&#41; &#123;$cpg_link_target=$arg_list[5&#93;;&#125;
if &#40;$cpg_link_target==""&#41;&#123;$cpg_link_target="_top";&#125;


//get pic info
$query "SELECT * from &#123;$CONFIG['TABLE_PICTURES'&#93;&#125; WHERE approved='YES' ";
if&
#40;$cgp_limit_album!=""&#41;&#123;$query.="AND aid='".$cgp_limit_album."'";&#125;
$query.=" AND user2!='1' ORDER BY ";
if&
#40;$cpg_random=="1"&#41;&#123;$query.="RAND&#40;&#41;";&#125;else&#123;$query.="ctime";&#125;
$query.=" DESC LIMIT 0,".$cpg_how_many;
$result mysql_query&#40;$query&#41;;
if &#40;$cpg_how_many!=1&#41;
&#123;
$return_value="<table align=\"center\" cellspacing=\"0\" cellpadding=\"10\" align=\"center\" class=\"maintable\" border=\"0\">";
$td_start="<td valign=\"middle\" class=\"thumbnails\" align=\"center\">\n";
$td_end="</td>";
$cpg_table_end="</table>";
$tr_start="<tr>\n";
$tr_end="</tr>\n";
&
#125;
else
&
#123;
$return_value="";
$td_start="";
$td_end="";
$cpg_table_end="";
$tr_start="";
$tr_end="";
&
#125;
$counter=0;
if &
#40;$cpg_thumbcols > $cpg_how_many&#41; &#123;$cpg_thumbcols=$cpg_how_many;&#125;

while &#40;$row = mysql_fetch_array&#40;$result&#41;&#41; &#123;
//------
if &#40;$counter==0&#41;&#123;$return_value.=$tr_start;&#125;
$return_value.=$td_start;
if &
#40;$cpg_include_link==1&#41;
  
&#123;
  
$return_value.= "<a href=\"";
    if &
#40;$cpg_link_singlepic==1&#41;
      
&#123;
       
if &#40;$cpg_link_target=="popup"&#41;
          
&#123;
          
$return_value.="javascript&#58;;\" onClick=\"MM_openBrWindow&#40;'".$url_of_cpg_dir."displayimage.php?pid=".$row['pid'&#93;."&fullsize=1','".uniqid&#40;rand&#40;&#41;&#41;."','toolbar=yes,status=yes,resizable=yes,width=".&#40;$row['pwidth'&#93;+16&#41;.",height=".&#40;$row['pheight'&#93;+16&#41;."'&#41;\"";
          
&#125;
          
else
          &
#123;
          
$return_value.=$url_of_cpg_dir."displayimage.php?&pos=-".$row['pid'&#93;;
          
&#125;
      
&#125;
    
else
      &
#123;
      
$return_value.=$url_of_cpg_dir."thumbnails.php?album=".$row['aid'&#93;;
      
&#125;
  
$return_value.="\" ";

  if&
#40;$cpg_link_target=="popup"&#41;&#123;$return_value.="";&#125;else&#123;$return_value.="target=\"".$cpg_link_target."\"";&#125;
  
$return_value.=">";
  &
#125;
$return_value.= "".$url_of_cpg_dir.$cpg_album_path.$row[rawurlencode&#40;'filepath'&#41;&#93;.rawurlencode&#40;$cpg_thumb_pfx.$row['filename'&#93;&#41;;
//if &#40;$row['title'&#93;!=""&#41; &#123;$return_value.= $row['title'&#93;."&#10;";&#125;
//if &#40;$row['caption'&#93;!=""&#41; &#123;$return_value.= $row['caption'&#93;."&#10;";&#125;
//if &#40;$row['keywords'&#93;!=""&#41; &#123;$return_value.= $cpg_lang_keywords . "&#58; " . $row['keywords'&#93;."&#10;";&#125;
//if &#40;$row['hits'&#93;!=""&#41; &#123;$return_value.= $row['hits'&#93;." ".$cpg_lang_views."&#10;";&#125;
//if&#40;$cpg_random=="1"&#41;  &#123;$return_value.= $cpg_lang_random;&#125;
//$return_value.= "\" align=\"left\" class=\"padright\">";
//if &#40;$cpg_include_link==1&#41;&#123;$return_value.="</a>";&#125;
//$return_value.=$td_end."\n";
$counter++;
if &
#40;$counter==$cpg_thumbcols&#41;&#123;$counter=0;$return_value.=$tr_end;&#125;
&#125;

$return_value.=$cpg_table_end;
return 
$return_value;
&
#125;

function cpg_single&#40;&#41;
&#123;
$numargs func_num_args&#40;&#41;;
$arg_list func_get_args&#40;&#41;;
if &#40;$numargs > 0&#41;&#123;return cpg_thumb&#40;1,1,1,"",0,$arg_list[0&#93;&#41;;&#125;
else&#123;return cpg_thumb&#40;1,1,1,"",0&#41;;&#125;
&#125;

function cpg_total_pics&#40;$cgp_limit_album&#41;
&#123;
GLOBAL $CONFIG,$cpg_decimal_point,$cpg_thousands_separator;
  
$query "SELECT COUNT&#40;*&#41; from &#123;$CONFIG['TABLE_PICTURES'&#93;&#125; WHERE approved = 'YES'";
  if&
#40;$cgp_limit_album!=""&#41;&#123;$query.=" AND aid='".$cgp_limit_album."'";&#125;
  
$result mysql_query&#40;$query&#41;;
  
$nbEnr mysql_fetch_array&#40;$result&#41;;
  
$pic_count $nbEnr[0&#93;;
  
mysql_free_result&#40;$result&#41;;
  
return number_format&#40;$pic_count,0,$cpg_decimal_point,$cpg_thousands_separator&#41;;
&#125;

function cpg_total_views&#40;$cgp_limit_album&#41;
&#123;
GLOBAL $CONFIG,$cpg_decimal_point,$cpg_thousands_separator;
  
$query "SELECT sum&#40;hits&#41; FROM &#123;$CONFIG['TABLE_PICTURES'&#93;&#125; WHERE 1";
  if&
#40;$cgp_limit_album!=""&#41;&#123;$query.=" AND aid='".$cgp_limit_album."'";&#125;
  
$result mysql_query&#40;$query&#41;;
  
$nbEnr mysql_fetch_array&#40;$result&#41;;
  
$view_count $nbEnr[0&#93;;
  
mysql_free_result&#40;$result&#41;;
  
return number_format&#40;$view_count,0,$cpg_decimal_point,$cpg_thousands_separator&#41;;
&#125;

function cpg_hit_ratio&#40;$cgp_limit_album&#41;
&#123;
GLOBAL $CONFIG;
//get stats
$result=mysql_query&#40;"SELECT sum&#40;hits&#41; FROM &#123;$CONFIG['TABLE_PICTURES'&#93;&#125; WHERE 1"&#41;;
$nbEnr mysql_fetch_array&#40;$result&#41;;
$hit_count = &#40;int&#41;$nbEnr[0&#93;;
$result=mysql_query&#40;"SELECT count&#40;*&#41; FROM &#123;$CONFIG['TABLE_PICTURES'&#93;&#125; WHERE 1"&#41;;
$nbEnr mysql_fetch_array&#40;$result&#41;;
$picture_count $nbEnr[0&#93;;
$cpg_ratio_string=str_replace&#40;".", ",",&#40;floor&#40;&#40;&#40;str_replace&#40;".", "", cpg_total_views&#40;$cgp_limit_album&#41;&#41;/str_replace&#40;".", "", cpg_total_pics&#40;$cgp_limit_album&#41;&#41;&#41;*10&#41;/&#40;$hit_count/$picture_count&#41;&#41;&#41;/10&#41;;
//$cpg_ratio_string=cpg_total_views&#40;$cgp_limit_album&#41;.'|'.cpg_total_pics&#40;$cgp_limit_album&#41;.'|'.$hit_count.'|'.$picture_count;
return $cpg_ratio_string;


&
#125;

function cpg_stat_string&#40;$cgp_limit_album&#41;
&#123;
GLOBAL $url_of_cpg_dir,$cpg_lang_pics,$cpg_lang_views;
$cpg_stat_string='[<a href="'.$url_of_cpg_dir.'thumbnails.php?album='.$cgp_limit_album.'"><b>';
$cpg_stat_string.=cpg_total_pics&#40;$cgp_limit_album&#41;;
$cpg_stat_string.='</b> ' $cpg_lang_pics '</a>, <a href="'.$url_of_cpg_dir.'thumbnails.php?album=topn&cat=-'.$cgp_limit_album.'"><b>';
$cpg_stat_string.=cpg_total_views&#40;$cgp_limit_album&#41;;
$cpg_stat_string.='</b> ' $cpg_lang_views '</a>';
$cpg_stat_string.=', <span class="tool" title="SF=Spanner-Faktor&#58;&#10;Wie oft sind die Bilder dieses Albums durchschnittlich angeklickt worden, im Vergleich zur gesamten Galerie?">SF&#58; '.cpg_hit_ratio&#40;$cgp_limit_album&#41;.'</span>';
$cpg_stat_string.='&#93;';
return 
$cpg_stat_string;
&
#125;

function cpg_total_albums&#40;&#41;
&#123;
GLOBAL $CONFIG,$cpg_decimal_point,$cpg_thousands_separator;
  
$query "SELECT count&#40;*&#41; FROM &#123;$CONFIG['TABLE_ALBUMS'&#93;&#125; WHERE 1";
  
$result mysql_query&#40;$query&#41;;
  
$nbEnr mysql_fetch_array&#40;$result&#41;;
  
$album_count $nbEnr[0&#93;;
  
mysql_free_result&#40;$result&#41;;
  
return number_format&#40;$album_count,0,$cpg_decimal_point,$cpg_thousands_separator&#41;;
&#125;

function cpg_total_comments&#40;&#41;
&#123;
GLOBAL $CONFIG,$cpg_decimal_point,$cpg_thousands_separator;
  
$query "SELECT count&#40;*&#41; FROM &#123;$CONFIG['TABLE_COMMENTS'&#93;&#125; WHERE 1";
  
$result mysql_query&#40;$query&#41;;
  
$nbEnr mysql_fetch_array&#40;$result&#41;;
  
$comments_count $nbEnr[0&#93;;
  
mysql_free_result&#40;$result&#41;;
  
return number_format&#40;$comments_count,0,$cpg_decimal_point,$cpg_thousands_separator&#41;;
&#125;

function cpg_total_cats&#40;&#41;
&#123;
GLOBAL $CONFIG,$cpg_decimal_point,$cpg_thousands_separator;
  
$query "SELECT count&#40;*&#41; FROM &#123;$CONFIG['TABLE_CATEGORIES'&#93;&#125; WHERE 1";
  
$result mysql_query&#40;$query&#41;;
  
$nbEnr mysql_fetch_array&#40;$result&#41;;
  
$cats_count $nbEnr[0&#93;;
  
mysql_free_result&#40;$result&#41;;
  
return number_format&#40;$cats_count,0,$cpg_decimal_point,$cpg_thousands_separator&#41;;
&#125;


function cpg_random&#40;&#41;
&#123;
return cpg_thumb&#40;1,1,1,"",1&#41;;
&#125;

function random_picture&#40;&#41;
&#123;
return cpg_thumb&#40;0,0,1,"",1&#41;;
&#125;

function cpg_search&#40;$cpg_size,$cpg_question,$cpg_submit_text&#41;
&#123;
GLOBAL $url_of_cpg_dir;
$cpg_search_string "<form method=\"get\" action=\"" $url_of_cpg_dir "thumbnails.php\" name=\"search_cpg\">
<input type=\"hidden\" name=\"album\" value=\"search\" />
<input type=\"hidden\" name=\"type\" value=\"full\" />
<input type=\"input\" name=\"search\" maxlength=\"255\" size=\"" 
$cpg_size "\" value=\"" $cpg_question "\" class=\"textfield\" onfocus=\"this.value=''\" />";
if &
#40;$cpg_submit_text!="" and $cpg_submit_text!="0"&#41;
  
&#123;
  
$cpg_search_string.= " <input type=\"submit\" value=\"" $cpg_submit_text "\" class=\"submit\" />";
  &
#125;
$cpg_search_string.= "</form>";
return 
$cpg_search_string;
&
#125;

function cpg_stats&#40;&#41;
&#123;
GLOBAL $CONFIG;
$result=mysql_query&#40;"SELECT count&#40;*&#41; FROM &#123;$CONFIG['TABLE_ALBUMS'&#93;&#125; WHERE 1"&#41;;
$nbEnr mysql_fetch_array&#40;$result&#41;;
$album_count $nbEnr[0&#93;;
mysql_free_result&#40;$result&#41;;

$result=mysql_query&#40;"SELECT count&#40;*&#41; FROM &#123;$CONFIG['TABLE_PICTURES'&#93;&#125; WHERE 1"&#41;;
$nbEnr mysql_fetch_array&#40;$result&#41;;
$picture_count $nbEnr[0&#93;;
mysql_free_result&#40;$result&#41;;

$result=mysql_query&#40;"SELECT count&#40;*&#41; FROM &#123;$CONFIG['TABLE_COMMENTS'&#93;&#125; WHERE 1"&#41;;
$nbEnr mysql_fetch_array&#40;$result&#41;;
$comment_count $nbEnr[0&#93;;
mysql_free_result&#40;$result&#41;;

$result=mysql_query&#40;"SELECT count&#40;*&#41; FROM &#123;$CONFIG['TABLE_CATEGORIES'&#93;&#125; WHERE 1"&#41;;
$nbEnr mysql_fetch_array&#40;$result&#41;;
$cat_count $nbEnr[0&#93; - $HIDE_USER_CAT;
mysql_free_result&#40;$result&#41;;

$result=mysql_query&#40;"SELECT sum&#40;hits&#41; FROM &#123;$CONFIG['TABLE_PICTURES'&#93;&#125; WHERE 1"&#41;;
$nbEnr mysql_fetch_array&#40;$result&#41;;
$hit_count = &#40;int&#41;$nbEnr[0&#93;;
mysql_free_result&#40;$result&#41;;


print $picture_count.", ".$album_count.", ".$cat_count.", ".$comment_count.", ".$hit_count;
&
#125;


//function taken from functions.inc.php
function db_connect&#40;&#41;
&#123;
        
global $CONFIG;
        
$result = @mysql_connect&#40;$CONFIG['dbserver'&#93;, $CONFIG['dbuser'&#93;, $CONFIG['dbpass'&#93;&#41;;
        
if &#40;!$result&#41;
                
return false;
        if &
#40;!mysql_select_db&#40;$CONFIG['dbname'&#93;&#41;&#41;
                
return false;
        return 
$result;
&
#125;

$total_pics cpg_total_pics&#40;""&#41;;
$total_albums cpg_total_albums&#40;&#41;;
$total_comments cpg_total_comments&#40;&#41;;
$total_views cpg_total_views&#40;""&#41;;
$random_picture random_picture&#40;&#41;;

$im ImageCreateTrueColor &#40;250, 75&#41;;             // Bild $im mit den Abmessungen 250x75 erzeugen 
$bgc ImageColorAllocate &#40;$im, 255, 255, 255&#41;;         // $bgc &#40;Hintergrund&#41; auf "weiß" setzten 
$farbe_text ImageColorAllocate &#40;$im, 0, 0, 132&#41;;         // Textfarbe 
$farbe_online ImageColorAllocate &#40;$im, 255, 0, 0&#41;;     // Textfarbe 
$tc ImageColorAllocate &#40;$im, 3, 5, 17&#41;;             // Textfarbe 
ImageFilledRectangle &#40;$im, 0, 0, 250, 75 ,$bgc&#41;;         // Bild $im mit der Hintergrundfarbe füllen 
ImageString&#40;$im, 3, 105, 7, "Daniel's Fotos", $farbe_text&#41;;     // Ausgabe von Text im Bild $im 
ImageString&#40;$im, 2, 105, 20, "$total_pics Pictures", $tc&#41;;     // Ausgabe von Text im Bild $im 
ImageString&#40;$im, 2, 105, 30, "$total_albums Albums", $tc&#41;;     // Ausgabe von Text im Bild $im 
ImageString&#40;$im, 2, 105, 40, "$total_comments Comments", $tc&#41;;     // Ausgabe von Text im Bild $im 
ImageString&#40;$im, 2, 105, 50, "viewed $total_views times", $tc&#41;;     // Ausgabe von Text im Bild $im 

imagecolortransparent&#40;$im, $bgc&#41;;             // Die Farbe $bgc wird für das Bild $im als transparent gesetzt 

$background $im ;                 // Das Bild $im wird als $background definiert 
$insert imagecreatefromjpeg&#40;$random_picture&#41;;         // Die Variable $random_picture, die eine URL enthält, wird als $insert definiert 


$insert_x imagesx&#40;$insert&#41;; 
$insert_y imagesy&#40;$insert&#41;; 

imagecopymerge&#40;$background,$insert,0,0,0,0,$insert_x,$insert_y,100&#41;; // Die Bilder werden zusammengesetzt 
imagecolortransparent&#40;$insert, $bgc&#41;;                 // Die Farbe $bgc wird für das gesamte Bild als transparent gesetzt 
header&#40;"Content-Type&#58; image/png"&#41;; 
imagepng&#40;$background,"",100&#41;; 
ImageDestroy &#40;$im&#41;; 
?>


Bruz
Logged
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.kingbruz.de%2FFotos%2Fsignatur_cpg.php&hash=0e1b702f24041a95544ac67a72041198)

get your statistik-hack here

turtleboy

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 36
    • SkylineDesigns
[Done] statistics as an image - have a look
« Reply #18 on: April 09, 2004, 10:21:49 pm »

Used exact same code you did, but random thumb never comes up with it, although all the stats are correct. Dont know how to fix this.

(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.skylinedesigns.net%2Ffoto%2Ffoto-gallery%2Fsignat.php&hash=3888cf608328b0e3086a977a73284622)

I thought it might be an .htaccess file issue, but it won't work even when viewing it locally, or if i remove the files.

Bruz

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 54
[Done] statistics as an image - have a look
« Reply #19 on: April 12, 2004, 11:52:40 am »

Maybe you are using a glib or php version, that doesn't support imagecopymerge...
Logged
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.kingbruz.de%2FFotos%2Fsignatur_cpg.php&hash=0e1b702f24041a95544ac67a72041198)

get your statistik-hack here
Pages: [1] 2 3 4 5   Go Up
 

Page created in 0.037 seconds with 21 queries.