plan2net / webp

Create a WebP copy for images (TYPO3 CMS)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Webp images are not served

notacoder-ui opened this issue · comments

Hi,

I used the extension version 2.2.2 in my typo3 version 9.5.19.

I followed the steps as described in the Readme file.

I selected external converter option in extension configuration and passed parameter as
image/jpeg::/usr/bin/cwebp -jpeg_like %s -o %s|image/png::/usr/bin/cwebp -lossless %s -o %s

and selected convert_all options too.

But, still webp images are served in my latest chrome browser.

Please help me where I am going wrong?

image (1)
image

@notacoder-ui which webserver are you using and what's your webserver configuration?
Did you check the TYPO3 log file (see documentation for troubleshooting advice)?

@notacoder-ui did you modify the htaccess file so webp images are served instead of jpeg? have you checked if webp images are being created in the proccessed folder?

@notacoder-ui I had the same problem. When you install via composer, the database table hasn't create and webp is not being generated. You have to run Upgrade wizard to create table: tx_webp_failed

@plojewski that's standard behaviour ;-)
If you don't use something like

typo3cms extension:setupactive

with the help of TYPO3 console extension, you won't get any new tables/fields when installing extensions with composer.

Hi. I had the same or a similar problem: in local development all works fine but in staging on a Strato-Server the redirect won't work. Extension, table in database, image (webp) generation worked but no image/webp result in browser inspector.

I solved it by testing hours around with the .htaccess stuff and resulted with this one in the beginning of the .htaccess file. (Changed the one line from the docs which checks if the file exists.)

#####
# Extension "webp": redirect to webp version of images
# (enable on production)

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{HTTP_ACCEPT} image/webp

    # The second line works with STRATO:
    # RewriteCond %{DOCUMENT_ROOT}/$1.$3.webp -f
    RewriteCond %{REQUEST_FILENAME}\.webp -f

    RewriteRule ^((fileadmin|other-storage)/.+)\.(png|jpg|jpeg)$ $1.$3.webp [L]
</IfModule>

<IfModule mod_headers.c>
    Header append Vary Accept env=REDIRECT_accept
</IfModule>

# type will be set in default typo3 stuff below
# AddType image/webp .webp
#####

Maybe this helps the one or other.

  RewriteCond %{HTTP_ACCEPT} image/webp
  RewriteCond %{REQUEST_FILENAME}\.webp -f
  RewriteRule ^ %{REQUEST_FILENAME}.webp [L]

ref. 3f4043f#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R132-R134