Lars M
Lars M

Reputation: 3

Cannot open webp picture in html

I just cannot display a .webp file.
Html code:

<body>
Test Webp/JPG images: <br /><br />
Image1 Webp (1.4 MB):<br />
<picture>
  <source type="image/webp" media="(min-width:650px)" srcset="../../240806_2066_GotaHovratt_450.webp" style="width:auto;">
  <img src="../../240806_2066_GotaHovratt_full.jpg" >
</picture>
<br /><br />
Image2, largest jpg (17 MB):<br />
<img src="../../240806_2066_GotaHovratt_full.jpg" width="1200" >
<br /><br />
Image3, highres jpg (1.2 MB): <br />
<img src="../Highres/240806_2066_GotaHovratt_20.jpg" width="1200" >
</body>

URL: arxfoto.se/data/_testwebp.html

I am using the w3schools.com HTML <picture> Tag example, and using Google Chrome which supports webp.
The 240806_2066_GotaHovratt_full.jpg file that is the backup - if the webp file is not functioning - is not either displayed, but it is displayed as a normal jpg file in an <img> tag. There is nothing wrong with the path, but the picture tag does not seem to work for me. What am I doing wrong?

Upvotes: 0

Views: 54

Answers (1)

Lars M
Lars M

Reputation: 3

After my provider’s technician returned from his vacation I have now got this information: The MIME type .webp is not automatically supported in IIS on their server. They would like to keep their IIS with the original settings. The MIME type “.Webp” is a recent addition and to have it supported I must put following code in my web.config file on my website:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
   <system.webServer>
      <staticContent>
         <mimeMap fileExtension=".webp" mimeType="image/webp" />
      </staticContent>
   </system.webServer>
</configuration>

After doing that I can also have .webp images displayed on my website. Problem solved.

Upvotes: 0

Related Questions