The simpler media website CMS
if (!defined('ZENFOLDER')) { define('ZENFOLDER', 'zp-core'); }
define('OFFSET_PATH', 0);
require_once(ZENFOLDER . "/template-functions.php");
$g = isset($_GET['g'])?$_GET['g']:"retouching";
$n = isset($_GET['n'])?$_GET['n']:8;
$c = 0;
$im = imagecreatetruecolor(($n*75)-4,71);
$fill= imagecolorallocate($im,255,255,255);
imagefill($im,0,0,$fill);
$_zp_current_album = new Album($_zp_gallery,$g);
$subalbums = $_zp_current_album->getAlbums();
if(isset($_GET['r']))
{
$keys = array_rand($subalbums, $n);
} else
{
while ($c < $n)
{
$keys[$c] = $c;
$c ++;
};
};
$c = 0;
foreach ($keys as $key){
$subalbumObj = new Album($_zp_gallery,$subalbums[$key]);
$tn = imagecreatefromjpeg(".".urldecode($subalbumObj->getAlbumThumb()));
imagecopy($im, $tn,($c*75), 0, 0, 0, 71, 71);
$c++;
};
header('Content-Type: image/jpeg');
imagejpeg($im, NULL, 100);
?>
`
I'm getting errors in the error_log that suggests that the URL zenphoto returns is trying to create a new thumbnail, rather than using the cached file. So I tried to pre-cache the thumbnails. This seems to work, however when clicking on the little thumbnail icon in overview-Cache page, it gives me the Debug i.php page for the thumbnail, and the image link is broken. If I look at the link to the image, it is;
http://www.domain.com/zp-core/http://www.domain.com/cache/motion/4e8a9d558dec0163873abeba1e44603effb17979.jpg
Maybe that doesn't matter, I'm not sure if that's really the problem. The error that we get in the error_log from ZenPhoto is;
[31-Jul-2012 11:23:34] PHP Warning: imagecreatefromjpeg(./zp-core/i.php?a=retouching/nokia&i=Nokia-Guitar-RGB-Final_WEB_ZP.jpg&w=71&h=71&c=1&cw=975&ch=975&cx=0&cy=139&q=75&t=1&wmk=!) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in /home2/username/public_html/signature_strip.php on line 36
[31-Jul-2012 11:23:34] PHP Warning: imagecopy(): supplied argument is not a valid Image resource in /home2/username/public_html/signature_strip.php on line 37
So it seems our signature_strip.php script asks for the URL of the thumbnail, ZenPhoto doesn't think it isn't cached so it returns a URL that generates a new thumbnail, however this is something that our script cannot handle? Is that correct? Or do I not understand it properly? Apologies as I did not write the script and I am not a PHP programmer. I am trying to find the root of the problem so I can either try and fix it myself, or better describe the issue to someone who is better versed in PHP.
Any help with this would be greatly appreciated!
thanks!
Tristan.
Comments
I suggest maybe to use the full images instead (use the unprotected full image functions as full images are cached as well if set to protected for watermarks etc).
You meantion a wrong link above. Try setting the webpath in the config file manually.
So I tried the nightly and no luck. I have noticed however that two of our thumbnails work (out of about 80). They are from the two subalbums that have been created since upgrading to 1.4.3. So the question is, why do newly created subalbum thumbnails correctly return to getAlbumThumb() whereas all older jobs return the image processor? Obviously we would like to avoid the scenario of having to re-add all of our subalbums to get this working...?
Acrylian you said;
<quote>You meantion a wrong link above. Try setting the webpath in the config file manually.</quote>
regarding the incorrect link on the debug cache page for thumbnails - to which config file do you refer?
Also, which thumbnail cache does the getAlbumThumb() fetch exactly? When I try to pre-generate the cache, there is a list of many options - which one is ZenPhoto supposed to grab using getAlbumThumb()? I.e. which one should I be trying to generate/regenerate?
thanks,
Tristan.
`getAlbumThumb()` fetches the default or standard thumb image size as set on the options. The cachemanager does allow you to set specific image sizes to precache if your theme uses custom size (e.g. those set on the theme layout and not options).
Following this process;
1. Edit album
2. Click 'Cache album images'
3. Apply 'default_85_cw71_ch71_thumb'
4. Provided they are not already cached, thumbnails are created and (in my test case) three small thumbnails appear on a line '3d/job { x | x | x } [3 images]'
5. Click on one of the tiny thumbnails before [3 images] and it opens a new debug page for the thumbnail image;
6. Following the 'Debug i.php | Arguments:' list, there is a line that says 'Image:'. After 'Image:' there is a broken link to the newly generated thumbnail.
The broken link listed on the debug page is;
/zp-core/http://www.domain.com.au/cache/3d/job/eb0cbe39a7151d199226c5485578323f60ec486b.jpg
When it should be;
http://www.domain.com.au/cache/3d/job/eb0cbe39a7151d199226c5485578323f60ec486b.jpg
Is this related possibly to my thumbnail woes? Or something else?
Thank you kindly for all your help and responses so far.
1. Cleared the image cache.
2. Recreated the default and admin thumbnails.
3. Refreshed the metadata.
4. Browsed the whole website to check existence of thumbnails and force it to generate any that might not have been generated for some strange reason
and now still no thumbnails returned by getAlbumThumb() in our script.
And, unfortunately, I now no longer get the thumbnails from the two newer albums that I used to get successfully.
In our theme options, we have the thumbnail size set to 85. Crop is set to 8.23529411765%, left and right, top and bottom. It says next to thumb size 'Standard thumbnails will be scaled to 85 pixels.' When I navigate the the album or subalbum on the webpage and check the dimensions of the thumbnails, they are indeed 85px x 85px. Under the sizes provided by the cache manager, 'default' is set to size 85, crop 71 x 71. How do I pre-generate the thumbnails used by our theme? Or is this not possible?
In a browser window I entered this (an extract from the error I got in the logs);
http://www.mydomain.com.au/zp-core/i.php?a=3d/top-model&i=TM_spaceship_Final_WEB_ZP.jpg&w=71&h=71&c=1&cw=911&ch=911&cx=293&cy=94&q=75&t=1&wmk=!
And I get a blank page. The logs then have;
Backtrace: USER NOTICE: Too few arguments! Image not found. in /home2/username/public_html/zp-core/functions-image.php on line 33
trigger_error called
from imageError (functions-image.php [33])
from i.php [41]
The site is crashed a few times in Safari 6 but that might be a server glitch.
I recommend to check the JS stuff you are doing as FF reports a few errors.
/signature_strip.php
you can see any relevant php details at;
/phpinfo.php
Thanks for the heads up on the javascript errors - it's nothing major - I believe it's related to using an older version of google analytics. I've used Safari 6 a fair bit on the site and am yet to see problems myself so I'm hoping that is just a server glitch.
``
That is of course really nonsense. COuld you maybe tell us what this is supposed to do? If that is supposed to be a custom page in Zenphoto context it is wrong:
http://www.zenphoto.org/news/theming-tutorial#custom-pages-with-the-example-of-archivephp-and-sl
The broken link itself seems to be a bug. Fixed in the nightly build. But probably not useful in this case since the image will not be rendered.
sbillard - I'm sorry I wasn't more clear - there aren't three x's on the line (`3d/job { x | x | x } [3 images]) - there are three thumbnail images, correctly generated and rendered. When I click on one of them it takes me to the debug page, and to the bug I described. Thanks for fixing it, perhaps it may help me.
I understand this is frustrating for you, and I apologise. It is very frustrating for me as well, and I am trying to work out what has changed so I can fix it, or if it is in fact a problem in zenphoto, and I am trying to give the best feedback I can to you so that it can be resolved. It seems that our script is perhaps still ok, and something may have gone awry somewhere in zenphoto's thumb caching, as I had two thumbs working ok with the script (from subalbums that had been created since upgrading to 1.4.3), but nothing else worked, and since I cleared the cache and regenerated all the thumbnails, and refreshed the metadata, now even those two don't work.
Please let me know if anything is still unclear, or if you need any more information from me.
thanks,
Tristan.
I guess the first thing I would do if I were you is reset the `Obscure cache filenames` option so you have a better clue as to what is in your cache. With that not set the file names have the sizing parameters imbedded. Most likely you are not getting a thumbnail of the same sizing as you have cached.
There could be many reasons for this, but most likely would be that when you run that script you do not have the theme (and therefore the theme options) properly established.
Could you please remove our website URL from the earlier post?
Thanks again,
Tristan.
The url has been removed.