phpthumb outputs previous file

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I've 4 source images; foto1.jpg, foto2.jpg, foto3.jpg, foto4.jpg

phpthumb generates:

1. foto1 with name foto1_160.jpg
2. foto1 again with name foto2_160.jpg !!
3. foto3 with name foto3_160.jpg
4. foto3 again with name foto4_160.jpg !!
5. etc.
Basically it outputs previous rendered thumb once more instead of
actual thumb, but does output with correct file name.

code snippet:

1. foreach($pics as $fname) {
2. $phpThumb->setSourceFilename($srcdir.$fname);
3. ...
4. if($phpThumb->GenerateThumbnail()) {
5.    $output_size_x = ImageSX($phpThumb->gdimg_output);
6.    $output_size_y = ImageSY($phpThumb->gdimg_output);
7.    if($phpThumb->RenderToFile($output_filename)) {
8.       echo 'Successfully rendered";
9.    }

phpThumb: 1.7.9-200805132119
PHP: 5.3.0

Re: phpthumb outputs previous file

On 26/07/10 13:39, pswiggers wrote:

Quoted text here. Click to load it

Should you create / unset a phpThumb object each time through the
foreach loop for each source file?


Denis McMahon

Re: phpthumb outputs previous file

Quoted text here. Click to load it

Hi Denis,

Thanks for your quick reply.

A work around (or the solution) could be as you say to create the
object each time again for each thumb to make. My guess is however
that the behaviour has something to do with caching the image. But
then I don't know how it knows the filename correctly (which is

For the moment I'll work around it in a way as you suggest. And I'll
have a try to read once through the code and config settings...

Cheers and thanks already for the help,


Site Timeline