upload and resize images

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
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

upload and resize images

Post by gurjit »

hi all,

i was wondering if there is anyway i could upload any sized image and php can detect whether its suppose to resize it into portrait or landscape. Also i wanted to only supply for example 120px width for landscape and 100px height for potrait and php to scale the missing height or width depending on which one its is (potrait or landscape).

is this possible?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Yes, this is possible.
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

Post by gurjit »

any good links i can use to get info on how to do this?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

There is a nice Uploading class in the code snipplet section

viewtopic.php?t=17214
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

Post by gurjit »

nice piece of script but it looks like it dont let you choose the width size and auto size the height depending on potrait and landscape upload i need to be able to either set the width or height and the one left blank auto sizes....unless i'm wrong.
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

No it doesnt, but you can simply work it out yourself. The method accepts the width and height of the thumbnail you want to create, so just change it to work out the ratio of the current image, and then resize accordingly.
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Start from: here
Post Reply