Image Resize Script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
01chris
Forum Newbie
Posts: 8
Joined: Mon Feb 04, 2008 7:30 am

Image Resize Script

Post by 01chris »

I have written a script which uploads an image to my server and adds various details about the image to mysql. I now want to add to the script so that it makes a thumbnail of the image.

I am going to be using gif files and jpeg files only.

I have tried a number of tutorials but cant seem to make them work, please could somebody post some simple code to do this task?

The location and name of the file that i want resized is stored in the variable $thumb .

I want this file to be overwritten with the new resized file as I have a fullsized copy of the image stored elsewhere.

I would like the dimensions of the new image to be 128 wide by 160 high (I dont care if the thumbnail ends up stretched or out of proportion)

Thanks
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

Re: Image Resize Script

Post by liljester »

have you tried the imagecopyresampled() function?
01chris
Forum Newbie
Posts: 8
Joined: Mon Feb 04, 2008 7:30 am

Re: Image Resize Script

Post by 01chris »

i had tried that but it turns out i had been using it incorrectly - all seems well now

thank you liljester
Post Reply