I have a question more than an issue. But anyways I set it up with an additional 320 in
$resolutions = array(1382, 992, 768, 480, 320);
Now when I visit on my iphone the images get resized to 480. Shouldn't this be 320 to fit the screen?
$resolution = $is_mobile ? min($resolutions) : max($resolutions);
which ultimately should return the 320, and I checked and the size is 320 by 480.
Anyone else see this issue?
I just tried on ipad and get same result, its creating the images based on the height not width of screen. But if I turn on your error reporting, mobile is true?
So i added this to the bottom of the file
$testRes = $is_mobile ? min($resolutions) : max($resolutions);
sendErrorImage("testRes is :" . $testRes . " And resolution is :" . $resolution );
and I get
testRes is:320 And resolution is:480
This is after a fresh cleaning of cookies, and cache. Am I wrong to be expecting 320?
The device resolution detection is done with JS. It creates a session cookie which then is processed in the adaptive-images.php.
It consideres both portrait and landscape mode as the higher value of screen width and height is used. In case of an iPhone that's 480 pixel. Otherwise the images would need to be scaled up by the browser in landscape mode.
But there is a commit to detect the orientation of the device on page load: mpecan@154056e
Of course when you then switch from portrait to landscape mode, the images need to be scaled up by the browser which results in quality loss.
Hi, sorry for the late reply!
Yes, you'd be wrong to expect the 320. AI goes off the largest screen dimension, not the one that's currently the width. It does this to avoid problems with browser caches. Imagine you view a page in portrait at 320. With the behaviour you expect it would download a 320px wide image and cache it. Now rotate your device and it needs a 480px image. But it won't request one, because there's one in the cache. At the wrong size.
The filesize difference between 320 and 480 is small, so it's not too big a problem.
I haven't (and will not) roll in the "Device Orientation" patch because it would result in this problem. The "patch" is a defect, not an enhancement.