I have made a script that will read a folder containing more folders, each containing more etc... and for each file it finds of .jpg it displays a thumbnail with a src of the jpg's directory/thumbs/jpg's name. If u get me, thats not really important, what is...
I need to create a script that allows a complete novice to add images to the gallery, all they have to do at the mo is upload the image.. but also upload a correctly sized thumbnail of that inside the directories thumbs folder.
Is there a way in Php to dynamically create a thumbnail of a certain size and good compression (IE 10kb max for a 150x150 thumb), or detect if the image has its corresponding thumb image in the thumbs folder, and if not create and upload one itself?
Creating thumbnails from jpg's
Moderator: General Moderators
-
TheBentinel.com
- Forum Contributor
- Posts: 282
- Joined: Wed Mar 10, 2004 1:52 pm
- Location: Columbus, Ohio
Re: Creating thumbnails from jpg's
You can look into imagejpeg(). The man page discusses other image-ish commands native to PHP.malpass wrote: Is there a way in Php to dynamically create a thumbnail of a certain size and good compression (IE 10kb max for a 150x150 thumb), or detect if the image has its corresponding thumb image in the thumbs folder, and if not create and upload one itself?
http://us3.php.net/manual/en/function.imagejpeg.php
If they don't do the trick, there's a package called imageMagick that lets you do all sorts of cool stuff to images. You could interface with it via the pass_thru() function.
I use imageMagick to grab comics from the web, flip them sideways, and shrink them so I can view them on my palm. VERY easy to work with.
-
TheBentinel.com
- Forum Contributor
- Posts: 282
- Joined: Wed Mar 10, 2004 1:52 pm
- Location: Columbus, Ohio
Re: Creating thumbnails from jpg's
Also take a look at imagecopyresized() http://us3.php.net/manual/en/function.i ... esized.phpTheBentinel.com wrote:You can look into imagejpeg().