?
Solved

Adaptive image question

Posted on 2013-05-25
6
Medium Priority
?
276 Views
Last Modified: 2013-05-26
adaptive-images.php

I'm experimenting with an adaptive image solution which uses htaccess to redirect image requests to a php file.  Depending on the user's device screen width, an appropriately-scaled image will be served.  I've attached the php file, showing the "break points" for screen width, in pixels.  

To test this, I'm using three devices to load a page with three images of different widths, but I'm not understanding the behavior which is observed.

For an iPhone, images which are 3820px wide and 1910px wide are cached as a 1382px image. An image 955px wide is not cached, but served at its native size.

For an iPad, the 3820px image is cached as a 2764px image.  The 1910px and 955px images are served without adjustment.

For a desktop, the result is the same as for the iPhone.

My questions:

1. What is the purpose of the 992, 768,  and 480px break points in the php file, if they were never used?

2. Why would an image which is almost 1000px wide not be scaled down for an iPhone?

3. For the iPad, how could the 3820px image be cached at 2764px, when 2764 is not one of the break points in the php file?

I'd appreciate some education.
0
Comment
Question by:ddantes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 39197188
#1.  There are a lot of other phones with smaller screens.  Are you aware that Apple's market share is only 10 to 25%?  Samsung and Nokia and others sell more than they do.  Apple is just the noisiest company in the US.

#2.  Uh... because iPhone 5 screens are larger than 1000px?  They also 'auto-scale' images and whole web pages unless you tell them not to.  See here for more info: http://en.wikipedia.org/wiki/IPhone

#3. The iThings scale images to suit themselves, not you.  They don't just accept what you give them.
0
 

Author Comment

by:ddantes
ID: 39197208
Dave:  Thanks for your reply, and your patience with my naivete.   Of the mobile visitors to my website, the majority use Safari iPad.  After that, iPhone is the most frequent, although still a small percent.  

I should have known that the retina display is >1000px.  

If I load the test page with a desktop whose screen resolution has been set to 800 x 600, there still is no caching of images whose native width is 1000px.  Can you explain that?
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39197240
No, I can't.  Do you mean caching in the browser?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:ddantes
ID: 39197331
Not caching in the browser, but in the a subfolder folder in the root directory, "ai-cache."   This adaptive image solution populates that folder with re-sized images which are supposedly the largest size which will work with the user's screen resolution.  This is supposed to speed up delivery of optimized images, especially for mobile devices with narrower bandwith.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39197342
No, I don't know anything about that or why it's not caching what you think it should.
0
 

Author Comment

by:ddantes
ID: 39197348
Fair enough.  Actuallly, I'm seeing more images in the cache folder now.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

770 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