Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image .HEIC not loaded properly on browsers

Tags:

html

image

heic

We have a mobile app that uploads images to our web server and those images are displayed on a dashboard that opens on browsers like chrome, IE and firefox latest versions; Our users have windows 7 machines or even Android or IOS mobiles; Images with extension .HEIC uploaded from IOS 11 are not displayed properly on any device; Before telling me that Windows 7 and ANDROID do not support .HEIC images, I have taken the image from the webserver to my PC: can anybody tell me why if I right click on that image and open it with any browser it opens successfully ?! And why, using the same browser, it won't be displayed through the dashboard ? I need to know if I can fix the problem somehow before I convert it to any compatible type like jpeg or png. Below is my dashboard final code and examples of errors thrown by the browsers:

<div class="HAL_Upload_Image_container">
   <div class="HAL_Upload_Image" style="background-image:url('http://myImageURL.com/My_Folder/10//2018/0618/123456/CLIENT%5C29-06-2018%2009-37-16%20AM-505.PNG');"></div>
   <div class="HAL_Image_Name"> 29-06-2018 09-37-16 AM-505 </div>
</div>

<div class="HAL_Upload_Image_container">
   <div class="HAL_Upload_Image" style="background-image:url('http://myImageURL.com/My_Folder/10//2018/0618/123456/CLIENT%5C29-06-2018%2009-37-16%20AM-739.PNG');"></div>
   <div class="HAL_Image_Name">  29-06-2018 09-37-16 AM-739 </div>
</div>

<div class="HAL_Upload_Image_container">
   <div class="BAN_Upload_Image" style="background-image:url('http://myImageURL.com/My_Folder/10//2018/0618/123456/CLIENT%5C29-06-2018%2009-37-16%20AM-942.HEIC');"></div>
   <div class="HAL_Image_Name">  29-06-2018 09-37-16 AM-942 </div>
</div>

Chrome has logged in the console: Failed to load resource: the server responded with a status of 404 (Not Found), if I paste the source in the browser same error is thrown

IE 11 did not log any error and image is not displayed

FireFox did log any error and image is not displayed as well

Safari has logged the same error as chrome

BUT the image exists in the folder as the 2 others; The 3 have the same URL but their names and extensions differ a bit ... Any hints?

like image 325
AlessHo Avatar asked Jul 02 '18 11:07

AlessHo


People also ask

Can browsers display HEIC?

As of February 2022, no browser supports HEIC format natively. For AVIF, Chrome, Firefox and Opera for desktop and Android support it. However, no browser on iOS or iPadOS, including Safari, supports AVIF format.

Why can't I open HEIC photos on my computer?

If you try to open a HEIC file on your Windows PC, you will find that your machine says the file format is not supported. That happens because Windows does not support this new image format that Apple uses on its latest iOS devices.

Why do HEIC photos not upload?

This new file format was introduced to offer better compression while still preserving image quality. The problem with HEIC is that it's not widely compatible with other apps or devices, and you may not be able to open a HEIC photo after moving it to your computer.


1 Answers

In your url, there is an extra / after the 10.

http://myImageURL.com/My_Folder/10//2018/0618/123456/CLIENT%5C29-06-2018%2009-37-16%20AM-942.HEIC

I'm assuming this was a typo when submitting here.

For HEIC, it is an Apple format on iOS. The browsers do not support this file type due to licensing agreements. I'm guessing your computer was somehow converting the image or the program was able to identify the filetype.

In short, there isn't a good way to display these images as .HEIC until the browser developers write in support.

Here is an article online that talks about solutions. It was written in 2020, so there may be better options out there.

https://shkspr.mobi/blog/2020/12/coping-with-heic-in-the-browser/

The CDN option may be the best bet since you are serving the images on a mobile app.

like image 185
mat335 Avatar answered Oct 07 '22 20:10

mat335