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

Posted on 2014-07-17
Last Modified: 2014-07-17
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.
Question by:epifanio67
    LVL 58

    Assisted Solution

    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.
    LVL 107

    Assisted Solution

    by:Ray Paseur
    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.
    LVL 33

    Accepted Solution

    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.

    Author Closing Comment

    Thank you experts.... your comments are very helpful...

    Featured Post

    Easy Project Management (No User Manual Required)

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now