PHP5: how to find an accurate ratio to resize imgs for mobile devices?

Hello Experts,

I am able to resize images using PHP. However, I am struggling to calculate an accurate size for mobile devices... is there an accurate ration to resize images for mobile devices?

Thanks for you help.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

There are a multitude of differing resolutions for mobile devices.
Trying to size an image to fit every one is a waste of time and effort.
Look at the media queries that Bootrap uses and just using a sizing algorithm for those sizes and just use a 100% width/height to let the image scale itself

But if this is only to save a few bytes even resizing the image is a bit of a waste of time.
Ray PaseurCommented:
You may not need to resize the images with PHP.  Have a look at this example.  Try different browsers and screen sizes.  Use "view source" to see what is going on.
mobil devices have TWO views, vertical and horizontal,  AND it may be difficult to have any way to get the screen resolution of the mobil anyway for the PHP, you can have a phone with a 3 1/4 inch screen with a res of 320 x 240,  to a newer iphone wid 960 x 1704 res (and larger phone res), and there's also 60 inch large "WEB-TV" which may be set as mobil. . . .
it is best to have correct HTML5 and CSS3 for viewpoint and media responses. if you have complex "zone areas" of stacked elements, you can use javascript to do precise image sizing.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
epifanio67Author Commented:
Thank you experts.... your comments are very helpful...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.