Solved

Adaptive image question

Posted on 2013-05-25
6
264 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
  • 3
  • 3
6 Comments
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 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 82

Expert Comment

by:Dave Baldwin
ID: 39197240
No, I can't.  Do you mean caching in the browser?
0
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

 

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 82

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

This article discusses how to create an extensible mechanism for linked drop downs.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

708 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

15 Experts available now in Live!

Get 1:1 Help Now