Okay, I’m making an image gallery and I need this to happen:
User specifies image using one of those ‘Browse’ form elements
Local filename gets passed to PHP for uploading
PHP makes two separate images from the uploaded file (discarding the original):
A thumbnail - 150px wide or 100px high
A large image - 640px wide or 480px high
Saves them to something_thumb.jpg and something.jpg
(We’ll just use “something” for now. I’ll have PHP name the files using a variable later)
The thing is, the images being uploaded all have different sizes and aspect-ratios, but they need to be resized to proportionally.
THUMBNAILS:
Resized proportionally to either 150px wide or 100px high, depending on whether the image is in landscape or portrait orientation. Uploaded as "something_thumb.jpg"
LARGE IMAGES:
Resized proportionally to either 640px wide or 480px high, depending on whether the image is in landscape or portrait orientation. Uploaded as "something.jpg"
I’d really really really appreciate any help with this, since it’s doing my head in.
Thanks in advance!
[COLOR=“Red”]EDIT: Made it a little less complicated…[/COLOR]
Your script looks like it only outputs one resized image, and it only resizes if the width exceeds a ceratin value (ie. doesn’t take into consideration height)
Thanks anyway! But I’m not sure if I can dissect and alter that code myself… I’m no PHP guru
oh, i know it’s not exactly what you were looking for, i just posted that so you could start looking at the different functions you would need.
what usually helps me figure out how to approach problems like this is to draw out a decision tree. basically map out the logic, then take it one step at a time.
Yeah, I know exactly what you mean. I’m right into that ‘thought organization’ stuff I’ve actually given this a lot of thought, but I really have no idea as to what PHP functions to use, how to use them, etc, etc… I thought it’d just be easier to ask someone who has experience. I’ve also got a lot of work to do for the front-end of the site…