EDIT: Slow response is caused by turning on Image statistic strip to "Random". Tested "latest", no problems. This may be theme issue. Not familiar with Image Statistic Strip on other themes.
I'm getting excessive load times of the index page when the user is not logged in. The initial load time when not logged in is around 87,000ms. After logging in, reloading the page, after emptying the cache is only 360ms. Logging out is also excessive at 79,000ms.
But.....going to directly to....... /zp-core/admin.php when not logged in (empty cache) is only 477ms.
I think it must be a database issue. I have 2 other Joomla based MySQL sites on same setup that load relatively quickly (300ms) initial load with empty cache.
I am not on a dedicated server.
MySQL version: 5.0.96, PHP Version 5.3.14, ZP 1.4.4.1b
http://www.loweprofile.com/gallery/http://www.loweprofile.com/gallery/zp-core/admin.phpAny ideas what is causing the slow response.
Comments
Not sure why this would effect logging out. Using the "latest" option does not effect logout either.
If "random" is selected, once user is logged in, different random images are loaded on every user refresh.
Soes the theme use the image_album_statistics function to get the random images?
Just tried to visit the site (the admin link of course has no use for anyone here) and the page is not compeltely rendered. So you should now do what you should have done already actually: Look at your server error log for any errors.
Here is the code:
`
<?php if ((getOption('image_statistic') != 'none') && ((function_exists('printImageStatistic')) || (getOption('image_statistic') == 'random'))) { ?>
<?php include('inc_print_image_statistic.php'); ?>
<?php } ?>
`
That code does not really help. The file included is a special theme based one. What functions does it use?
`
/* zpArdoise_printImageStatistic
- use improvements of zenphoto 1.4.2 on printRandomImages and printImageStatistic (http://www.zenphoto.org/trac/ticket/1914)
- implements call of colorbox (http://www.zenphoto.org/trac/ticket/1908 and http://www.zenphoto.org/trac/ticket/1909)
*/
function zpArdoise_printImageStatistic($number, $option, $albumfolder='', $showtitle=false, $showdate=false, $showdesc=false, $desclength=40, $showstatistic='', $width=NULL, $height=NULL, $crop=NULL, $collection=false, $fullimagelink=false, $a_class=NULL) {
$images = getImageStatistic($number, $option, $albumfolder,$collection);
if (is_null($crop) && is_null($width) && is_null($height)) {
$crop = 2;
} else {
if (is_null($width)) $width = 85;
if (is_null($height)) $height = 85;
if (is_null($crop)) $crop = true;
}
echo "\n
echo "
";
- getTitle()) . "\">\n";
";
foreach ($images as $image) {
$fullimage = getFullImageURL($image);
if(($fullimagelink) && (!empty($fullimage))) {
$aa_class = ' class="' . $a_class . '"';
$imagelink = html_encode($fullimage);
} else {
$aa_class = NULL;
$imagelink = html_encode(getURL($image));
}
echo "
switch ($crop) {
case 0:
echo "getCustomImage($width, NULL, NULL, NULL, NULL, NULL, NULL, TRUE)) . "\" alt=\"" . html_encode($image->getTitle()) . "\" />\n";
break;
case 1:
echo "getCustomImage(NULL, $width, $height, $width, $height, NULL, NULL, TRUE)) . "\" alt=\"" . html_encode($image->getTitle()) . "\" />\n";
break;
case 2:
echo "getThumb()) . "\" alt=\"" . html_encode($image->getTitle()) . "\" />\n
";
break;
}
if($showtitle) {
echo "
getImageLink()) . "\" title=\"" . html_encode($image->getTitle()) . "\">\n";
\n";echo $image->getTitle() . "
}
if($showdate) {
echo "
" . zpFormattedDate(DATE_FORMAT,strtotime($image->getDateTime())) . "
";}
if($showstatistic === "rating" OR $showstatistic === "rating+hitcounter") {
$votes = $image->get("total_votes");
$value = $image->get("total_value");
if($votes != 0) {
$rating = round($value/$votes, 1);
}
echo "
" . sprintf(gettext('Rating: %1$u (Votes: %2$u)'), $rating, $votes) . "
";}
if($showstatistic === "hitcounter" OR $showstatistic === "rating+hitcounter") {
$hitcounter = $image->get("hitcounter");
if(empty($hitcounter)) { $hitcounter = "0"; }
echo "
" . sprintf(gettext("Views: %u"), $hitcounter) . "
";}
if($showdesc) {
echo shortenContent($image->getDesc(), $desclength,' (...)');
}
echo "
}
echo "
}
`
Just a thought. Might not work well for other situations, where admin wants not logged in users to see image strip.
I have no proble with zpArdoise_printRandomImages who follows printRandomImages code.
@tplowe56 : please, could you have some tests ?
1/ in my theme zpArdoise, replace code (backup original file before) :
inc_print_image_statistic.php, lines 30 to 34
replace
`
if (getOption('use_colorbox_album')) {
zpArdoise_printRandomImages($number, NULL, 'all', '', NULL, NULL, NULL, true, 'colorbox');
} else {
zpArdoise_printRandomImages($number, NULL, 'all', '', NULL, NULL, NULL, false);
}
`
by
`
if (getOption('use_colorbox_album')) {
printRandomImages($number);
} else {
printRandomImages($number);
}
`
2/ in official garland theme, replace code (backup original file before) :
gallery.php, line 75 to 82
replace
`
<?php
if (function_exists('printLatestImages')) {
?>
<?php echo gettext('Latest Images'); ?>
<?phpprintLatestImages(7);
}
?>
`
by
`
<?php
if (function_exists('printRandomImages')) {
?>
<?php echo gettext('Latest Images'); ?>
<?phpprintRandomImages(7);
}
?>
`
and let us know the results
64,000ms when not logged in
1,082ms when logged in
There is no PM on this forum. I will grant full access to site, if you want, through other communication.
I'll tell you the back of my mind: all your albums are protected by a password, but your gallery is public.
so, show recent images or random pictures is a nonsense.
if you want to keep your albums protected, you'd better not show images (Image Show Statistic strip = none), or you could display these images only if you are connected, by wrapping existing code like that (in gallery.php, lines 26 to 28) :
`
<?php if (zp_loggedin()) { ?>
<?php if ((getOption('image_statistic') != 'none') && ((function_exists('printImageStatistic')) || (getOption('image_statistic') == 'random'))) { ?>
<?php include('inc_print_image_statistic.php'); ?>
<?php } ?>
<?php } ?>
`
another solution : you could protect your gallery with a password (admin/gallery/gallery password) and not protect the albums.
everybody who wants vist your gallery should be connected and so, you don't have the problem.
@ zenphoto team :
I don't know how are supposed to work `printRandomImages()` and `printImageStatistic()` in that case (all albums are password protected, so no images are supposed to be shown)
That code corrects all my problems. Index page loads fine now for not logged in viewer. And logging out is fast also.
Unfortunately I can't write PHP or SQL code, just enough copy & paste, & search to be dangerous!
FYI: printRandomImages() and printImageStatistic() does not show any images to not logged in viewers, it shows an empty box containing "Random images", so images are still protected.
the function can't find any picture to shown.
I don't have a look on the code of the function, but I'm sure that something goes wrong here.
But really, printing random images when the viewer is not allowed to see anything does not make sense, so Vincent's change would be needed anyway.
as told before, have protected album and want to show pictures (random, latest,...) is a non sense.
but I think taht zenphoto should be "protected" from very long sql query that occur in that case...
I am an ex-professional photographer, and also have worked in advertising, and design so even though my gallery is only family photos I am very picky about the design & user experience of my gallery. The Tag Cloud and Random photos are great features for a family gallery, that lead people to old memories that they may forgotten. Everyone loves these features.
These are features that I would never have dreamed of when I started the gallery 12 years ago, and just used html and css to design. My extended family loves what I have created.
I suppose my distinct set of demands leads me to settings that end up breaking the software (sorry about that!) but really may not be used by many others.
So my hats off to all 3 of you. You do fabulous work. And thanks for the great support!