Uploading an image AND creating a thumb

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
reverend_ink
Forum Contributor
Posts: 151
Joined: Sun Apr 20, 2003 1:18 am
Location: Las Vegas | London

Uploading an image AND creating a thumb

Post by reverend_ink »

OK having an issue I cant find an aswer to online or in a book.

I am trying to upload a single image, log it in a database as well as create thumbnail of a certain size at the same time without having to upload twice, and log both pics to the same mysql table.

Is this possible?

Thanks
herod1
Forum Newbie
Posts: 5
Joined: Wed Apr 23, 2003 2:40 am
Location: Sweden

Re: Uploading an image AND creating a thumb

Post by herod1 »

reverend_ink wrote:OK having an issue I cant find an aswer to online or in a book.

I am trying to upload a single image, log it in a database as well as create thumbnail of a certain size at the same time without having to upload twice, and log both pics to the same mysql table.

Is this possible?

Thanks
I don't think that you could do it in one statement. But if you upload the file then you will know the local name and then you can create your thumb. You will need to have the GD libraries available to you in your PHP installation to make thumbnails and be aware that this no longer handles GIF image formats.
pootergeist
Forum Contributor
Posts: 273
Joined: Thu Feb 27, 2003 7:22 am
Location: UK

Post by pootergeist »

as herod said, having access to either GD (my favourite), imageMagick or Gimp on the server will be the best way of creating the thumbnails - if you let us know which module and build / version you have, we can help further.

personally I would reccommend using an auto_increment (INT) id field in the database and use that value to name both the large image and the thumbnail (with a prefix or suffix) as that assures you never accidentally overwrite an already uploaded file.

more help once first question answered - best reply would be 'umm GD2+' ;)
Post Reply