plan2net / webp

Create a WebP copy for images (TYPO3 CMS)
GNU General Public License v3.0
60 stars 34 forks source link

Files are there but still normal picture loading #22

Closed twixwix closed 4 years ago

twixwix commented 4 years ago

I have installed the extension and made the adjustments to the htaccess file. the webp files were created but on the website only the normal files like .jpg or .png are loaded, what have I done wrong?

is there a way to test the whole thing?

I am using Typo3 9.5.10 also my webserver is supporting webp trough imagemagick.

the-hotmann commented 4 years ago

How do you define the "normal .jps or .png" are loaded? Because of the Link? Pls check the Mime-Type (in the Chrome Dev-Console) and report back if the ".ong" Files are png files or webP Files delivered as .png files.

Also if they are real png-Files then your htacces is not working

twixwix commented 4 years ago

I checked it in Chrome and there are still the png and jpg types so I guess it's the htaccess which has problems. I took the original one from typo3 and added the lines.

I did several tests with the apache snippet always the same result.

  1. I tried to place them in the end of the htaccess file in the custom section
  2. Also I tried to place them in the given section.

Here is my htaccess: htaccess.txt

wazum commented 4 years ago

What's the path to your image? mod_rewrite and mod_headers Apache modules are active? Is the rewrite via .htaccess allowed in your apache configuration (check AllowOverride directive)?

twixwix commented 4 years ago

All of them are active and enabled. The path to my images is: /httpdocs/web/fileadmin/_processed_/ and from the frontend it looks like.. /fileadmin/_processed_/1/1/csm_black-and-white-black-and-white-challenge-262488_8fa0798411.jpeg

wazum commented 4 years ago

And the webp file is there at /fileadmin/_processed_/1/1/csm_black-and-white-black-and-white-challenge-262488_8fa0798411.jpeg.webp? And the response header (Chrome Developer Network tab) really shows content-type: image/jpeg instead of content-type: image/webp?

twixwix commented 4 years ago

Yes both are there and the chrome header show the jpeg format.

chromedev images
wazum commented 4 years ago

I hope you can resolve your (server) issue, but I fear it has nothing to do with the extension, so I'm closing this issue.

NitinParri commented 4 years ago

@twixwix don't know if you already fixed the problem you had with your server, but i had the same issue with Plesk, this is how i fixed it:

In /etc/nginx/nginx.conf add the following lines just before include /etc/nginx/conf.d/*.conf;:

map $http_accept $webp_suffix {
    default   "";
    "~*webp"  ".webp";
}

Then go to Home > Subscriptions > example.com > Websites & Domains > Apache & nginx Settings and remove png jpeg jpg in the textarea below the checkbox Serve static files directly by nginx.

On the same page go to Additional nginx directives and add the remaining lines to the textarea below:

location ~* ^/fileadmin/.+\.(png|jpg|jpeg)$ {
    add_header Vary Accept;
    try_files $uri$webp_suffix $uri =404;
}
location ~* ^/other-storage/.+\.(png|jpg|jpeg)$ {
    add_header Vary Accept;
    try_files $uri$webp_suffix $uri =404;
}

Hope this will help you.