![]() |
|
Stats on your gallery - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: Stats on your gallery (/thread-1977.html) |
Stats on your gallery - edasque - 2007-12-23 Any interest in this and more ? http://www.frenchguys.com/gallery/index.php?p=stats Stats on your gallery - sbillard - 2007-12-23 Nice. You could put it up in the WIKI in the hacks section http://www.zenphoto.org/trac/wiki/ZenphotoHacks Stats on your gallery - acrylian - 2007-12-23 edasque: I suppose you maybe use the google graphics api for that? Stats on your gallery - edasque - 2007-12-23 I sure am. I'll pretty up the code a bit, it's really pretty simple. function pie_graph($col,$title)
} Stats on your gallery - sbillard - 2007-12-24 Have you thought of adding other stats? I think one on hitcounts would be really nice. Stats on your gallery - edasque - 2007-12-24 You mean, how many images have a given hitcount in a pie chart ? What exactly are you thinking about ? I'd like to do total hitcount over time but that's not easy unless I use a crontab and do my own accounting. Stats on your gallery - sbillard - 2007-12-24 I meant the distribution of hits over images and/or albums Stats on your gallery - edasque - 2007-12-24 Like, how many images have 60+ hits, how many 40+, ... ? Stats on your gallery - sbillard - 2007-12-25 Yes, that but also maybe a pie chart of all images with more than some threshold of hits. that shows each album's slice of the pie. Stats on your gallery - timo - 2007-12-27 That's fantastic. I just added this to my gallery http://t413.com/gallery/ and I am very impressed. Stats on your gallery - edasque - 2007-12-28 Yes, I was thinking of doing that, it wouldn't be that difficult but it would be best to provide a UI so one could zoom in and look at different periods. Now that I think of it, it's quite an UI challenge I'll try to whip out something but I don't know PHP very well (or at all). I wouldn't mind an excuse to build a sparkline too Stats on your gallery - timo - 2007-12-28 Hey, I've been working with the function you created because I knew the data it was returning to be inaccurate. I looked through http://code.google.com/apis/chart/ and found that the type of encoding you used (text encoding) only accepts values from 0 to 100. On my gallery I've got 14,459 photos, 10,998 of which were taken by my XTi. When graphed any values over 100 were kept at 100, making the graph absolutely wrong. I fixed that in my the revised function below by turning each value into a percentage. Also, the "unknown" label was not working for my data, and by changing the ` ``function pie_graph($col,$title) { $sql = "SELECT count( * ) AS $result = mysql_query($sql); while($r = mysql_fetch_array($result)) { $current_Label = $r[1]; if (empty($current_Label)) { $Label .= 'Unknown|'; } else { $Label .= $r[1].'|'; } $Values .= ( ($r[0])/100 ).','; } $Label=trim($Label,"|"); $Values=trim($Values,","); }` Stats on your gallery - timo - 2007-12-28 Oops, that's not the one with the percentage, that just divides the result by 100. This is the right function: function pie_graph($col,$title) { $photosArray = query_single_row("SELECT count(*) FROM ".prefix('images')); $photosNumber = array_shift($photosArray); //get total number of images $sql = "SELECT count( * ) AS Rows , ".$col." FROM images GROUP BY ".$col." ORDER BY ".$col." LIMIT 0, 30"; $result = mysql_query($sql); while($r = mysql_fetch_array($result)) { $current_Label = $r[1]; if (empty($current_Label)) { $Label .= 'Unknown|'; } else { $Label .= $r[1].'|'; } $Values .= round( (($r[0])/$photosNumber*100),2).','; } $Label=trim($Label,"|"); $Values=trim($Values,","); } ` Stats on your gallery - edasque - 2007-12-29 Yeah, I found that out when I was working on the bar graph. Glad you were able to fix it. These are just hacks and deserve a well written set of functions that are more generic and probably use the extended encoding. Stats on your gallery - timo - 2007-12-30 I'm interested to see your timeline bar graph function, I'd like to work on it myself but don't really have a good enough handle on mysql to know where to start. Stats on your gallery - edasque - 2007-12-30 Ok, so several things:
It retrieves the last 62 days with photos (that's all you can plot with google charts unless you want to plot by month or by another slice of time than day and then you have to do some arithmetic).
I think the same must apply to ISO, F/STOP, Focal Length, Focal Length Equivalent. It might be also useful to display focal length for SLR cameras only as the Focal Length or FL equivalent for compacts is just not as interesting.
A lot more work, indeed. Stats on your gallery - edasque - 2007-12-30 The month query for the bar graph could look like this : SELECT COUNT( DATE_FORMAT( date, '%x%m' ) ) , DATE_FORMAT( date, '%x%m' ) |