troubleshooting Question

Use php to get a photo in the right proportions

Avatar of hrolsons
hrolsonsFlag for United States of America asked on
PHP
14 Comments2 Solutions505 ViewsLast Modified:
I have a folder full of .jpg files of all kinds of random dimensions and sizes.  I have used php for manipulating images but it has been a while.

I wish to print them all to 8"x12" paper and have nothing cropped or stretched from the original.

What I am currently doing is manually adding black bars to meet the correct dimensions.

Since I'm printing to 8"x12" the ratio is 1/1.5 or 0.667

So a photo coming in at 3000x4000 will finalize at 3000x4500 with black on top & bottom of 3000x250

A picture coming in at 2500x10000 will finalize at 6666x10000 with black bars on right & left of 2083x10000

Hopefully I'm being clear.  The incoming photo will be of varying sizes, both landscape & portrait.  They will all print to 8"x12" or 12"x8" with no stretching or cropping.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 14 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros