iPhone not displaying amp-img images
Please only file reports about bugs in AMP here.
What's the issue?
I'm building an AMP website and during testing on both Android and iPhone devices I realised that amp-img images aren't displaying on iOS devices on Safari, Chrome and Firefox, however it is working on UC Browser... I keep getting the console error "Failed to load: image - v0.js:127". I have tried <amp-img fallback> to test different image types.
I posted to StackOverflow with code snippet and discussion with no answers as yet - https://stackoverflow.com/questions/58236776/amp-img-images-not-showing-on-iphone
How do we reproduce the issue?
- Visit: http://redfoxluxurycarhire.com/test/en/amp/car on any iOS device using Safari, Chrome or Firefox and you will see that no images are being loaded due to v0.js:127
What browsers are affected?
Tested on Safari, Chrome and Firefox on iOS devices - iPhone and iPad. Curiously UC Browser does show the images.
Which AMP version is affected?
amp-version="1909181902540"
It looks like there are many <amp-img> tags with src set to images with extension .webp. WEBP images are not supported on iOS by any browser that uses the webkit renderer.
Sorry but that is not the issue. If you had read through, I have used fallback with png images, I've also removed the fallback and used only png images... the result is always the same: error v0.js:127. Regardless of the image type, if I'm on an iOS device using any browser other than UC Browser, the images will not show.
Sorry, when I didn't see webp mentioned anywhere in your title or post, I jumped to conclusion. Still, when I fetch https://redfoxluxurycarhire.com/test/assets/img/upload/car_images/1569501218.png and analyze the image, it does not appear to be a PNG:
$ identify 1569501218.png
Decoded /tmp/magick-22555vlN4SsB0duBk. Dimensions: 508 x 340 . Format: lossy. Now saving...
Saved file /tmp/magick-22555IU2sYzggPjMB
1569501218.png PAM 508x340 508x340+0+0 8-bit TrueColor sRGB 690949B 0.000u 0:00.009
Compare to an actual PNG:
$ identify 1569501218-simple.png
1569501218-simple.png PNG 508x340 508x340+0+0 8-bit sRGB 116538B 0.000u 0:00.000
Similarly, when I load the PNG into GIMP, here are the image properties that are returned:

Are you sure your fallback image has the format you intend? And that it is supported by iOS?
That's really strange. I'll check those images and reupload the png to make sure that isn't the issue, then get back to you. Regardless, why would Chrome on Android be able to see those images as png and not Chrome on iOS?
You've nailed it. I've just re-uploaded that same image .png and it is now showing. I must have somewhere along the line mis-converted those png files. You're a life saver!
Regardless, why would Chrome on Android be able to see those images as png and not Chrome on iOS?
It's not that Chrome on Android sees those as PNGs, it's that file extensions (if any) are ignored. The browser detects the image encoding independent any extension to determine if it can be decoded. Chrome on Android uses the blink rendering engine (has webp support). Chrome on iOS uses webkit (does not have webp support). See here: https://stackoverflow.com/questions/11259152/chrome-ios-is-it-just-a-uiwebview
Glad the issue is resolved.