majocmatt Posted May 1, 2006 Share Posted May 1, 2006 I'm wanting to make an upload script, which first checks if the image's width is over 500px, and if so, create a new file and resize image to 500px width and resize height proportionately to the new width.Now a script that I have always used that creates new thumbnails for each photo in my gallery, but thats a hard and fast script, no dynamic ability. It simply takes every image and squeezes them down to a specified width and height, and saves them as a new file.I've read a little and probably can figure out the first part of my problem by using the getimagesize() function to get and challenge the image width being uploaded, but how exactly would i proportionately resize the height?In a simple case, I could do start like this I suppose:[code]<?php$dimensions = getimagesize($_FILES['myfile']);$width = $dimensions[0];if($width >= 501) { // create new file and set new width, but how to proportionately bring in the height too??}?>[/code]Any ideas? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.