Save generated thumbnail Directory/Filename.jpg

Hi there,

Bit of a beginner here, so please bare with me…

I have a script that currently generates thumbnails, but on the fly and does not save them in a directory. There is a line in the code that says:

[php]//output thumbnail to this page. if you wanted to save the thumbnail somewhere, change the null to a target file
imagejpeg($thumb, null, 100 );
}[/php]

I have experimented with a few bits, and have looked around to find the answer…

The script generates thumbnails from a directory, so there are many files to save, I need to find a way to maybe save the thumbnails in the directory, with the same filename as the original (or tn_originalfilename.jpg)

I think it must be fairly simple, but I am fairly simple and cant work it out…

I have got:

[php]imagejpeg($thumb, ‘thumbs/***’, 100 );
}[/php]

*** = the expression for dynamic filename. That I cant work out. Whatever I put in there outputs into the thumbs folder on my server, am I even close?

Thanks so much in advance

Jody

Can you post the full code? To help you add the dynamic name I’d have to see where a name is set.

Sponsor our Newsletter | Privacy Policy | Terms of Service