Add webp image processing

This commit is contained in:
Björn Fromme
2021-12-26 20:04:12 +01:00
parent 3d8e22c2fc
commit 2a44103ba3
4 changed files with 68 additions and 157 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ hooks:
- exec: sudo chmod 600 /home/fromme/.ssh/authorized_keys - exec: sudo chmod 600 /home/fromme/.ssh/authorized_keys
- exec: sudo service ssh start - exec: sudo service ssh start
omit_containers: [dba] omit_containers: [dba]
webimage_extra_packages: [ssh] webimage_extra_packages: [ssh,webp]
use_dns_when_possible: true use_dns_when_possible: true
timezone: Europe/Berlin timezone: Europe/Berlin
composer_version: "2" composer_version: "2"
+1
View File
@@ -19,6 +19,7 @@
"kigkonsult/icalcreator": "^2.29", "kigkonsult/icalcreator": "^2.29",
"league/csv": "^9.2", "league/csv": "^9.2",
"league/period": "^4.9", "league/period": "^4.9",
"plan2net/webp": "^4.1",
"ssch/typo3-encore": "^3.0", "ssch/typo3-encore": "^3.0",
"symfony/http-client": "^4.3", "symfony/http-client": "^4.3",
"symfony/options-resolver": "^4.2", "symfony/options-resolver": "^4.2",
Generated
+57 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "097da910258a46f5f1bcc5aeee693ca4", "content-hash": "bec75d11ac7a00055213b40b9e6fd574",
"packages": [ "packages": [
{ {
"name": "b13/container", "name": "b13/container",
@@ -2904,6 +2904,62 @@
], ],
"time": "2021-12-25T07:07:57+00:00" "time": "2021-12-25T07:07:57+00:00"
}, },
{
"name": "plan2net/webp",
"version": "4.1.0",
"source": {
"type": "git",
"url": "https://github.com/plan2net/webp.git",
"reference": "0c60cdf38b6fe335e1a1813b8e3cc8ac1cd8b3be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/plan2net/webp/zipball/0c60cdf38b6fe335e1a1813b8e3cc8ac1cd8b3be",
"reference": "0c60cdf38b6fe335e1a1813b8e3cc8ac1cd8b3be",
"shasum": ""
},
"require": {
"ext-gd": "*",
"php": ">=7.2.0",
"typo3/cms-core": "^10.4|^11.5"
},
"type": "typo3-cms-extension",
"extra": {
"typo3/cms": {
"extension-key": "webp"
}
},
"autoload": {
"psr-4": {
"Plan2net\\Webp\\": "Classes/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-3.0"
],
"authors": [
{
"name": "Wolfgang Klinger",
"role": "Lead Developer"
},
{
"name": "Martin Kutschker",
"role": "reStructuredText Documentation"
},
{
"name": "Team Wonderland",
"role": "Support and review"
}
],
"description": "Creates WebP copies for images (TYPO3 CMS)",
"homepage": "https://www.plan2.net/",
"support": {
"issues": "https://github.com/plan2net/webp/issues",
"source": "https://github.com/plan2net/webp/tree/4.1.0"
},
"time": "2021-11-08T18:03:00+00:00"
},
{ {
"name": "psr/cache", "name": "psr/cache",
"version": "1.0.1", "version": "1.0.1",
+9 -155
View File
@@ -15,6 +15,8 @@
</FilesMatch> </FilesMatch>
AddEncoding gzip .gzip AddEncoding gzip .gzip
AddType image/webp .webp
<IfModule mod_deflate.c> <IfModule mod_deflate.c>
# Force compression for mangled `Accept-Encoding` request headers # Force compression for mangled `Accept-Encoding` request headers
<IfModule mod_setenvif.c> <IfModule mod_setenvif.c>
@@ -221,6 +223,9 @@ AddDefaultCharset utf-8
<FilesMatch "\.(eot|otf|tt[cf]|woff2?)$"> <FilesMatch "\.(eot|otf|tt[cf]|woff2?)$">
Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Origin "*"
</FilesMatch> </FilesMatch>
<FilesMatch "\.(png|gif|jpe?g)$">
Header append Vary Accept
</FilesMatch>
</IfModule> </IfModule>
### End: Cross Origin ### ### End: Cross Origin ###
@@ -277,161 +282,10 @@ AddDefaultCharset utf-8
# NOTE: Add your additional local storages here # NOTE: Add your additional local storages here
RewriteRule ^(?:typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L] RewriteRule ^(?:typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
### Begin: StaticFileCache (preparation) #### RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} (.*)\.(png|gif|jpe?g)$
# Document root configuration RewriteCond %{REQUEST_FILENAME}\.webp -f
RewriteRule .* - [E=SFC_ROOT:%{DOCUMENT_ROOT}] RewriteRule ^ %{REQUEST_FILENAME}\.webp [L,T=image/webp]
# Cleanup URI
RewriteCond %{REQUEST_URI} ^.*$
RewriteRule .* - [E=SFC_URI:/%{REQUEST_URI}]
RewriteCond %{REQUEST_URI} ^/.*$
RewriteRule .* - [E=SFC_URI:%{REQUEST_URI}]
RewriteCond %{REQUEST_URI} ^/?$
RewriteRule .* - [E=SFC_URI:/]
# Cleanup HOST
RewriteCond %{HTTP_HOST} ^([^:]+)(:[0-9]+)?$
RewriteRule .* - [E=SFC_HOST:%1]
# Disable cache for EXT:solr indexing requests
RewriteCond %{HTTP:X-Tx-Solr-Iq} .+
RewriteRule .* - [E=SFC_HOST:invalid-host]
# Get scheme
RewriteRule .* - [E=SFC_PROTOCOL:http]
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} https
RewriteRule .* - [E=SFC_PROTOCOL:https]
# Get port
RewriteRule .* - [E=SFC_PORT:80]
RewriteCond %{ENV:SFC_PROTOCOL} ^https$ [NC]
RewriteRule .* - [E=SFC_PORT:443]
RewriteCond %{SERVER_PORT} ^[0-9]+$
RewriteRule .* - [E=SFC_PORT:%{SERVER_PORT}]
RewriteCond %{HTTP:X-Forwarded-Port} ^[0-9]+$
RewriteRule .* - [E=SFC_PORT:%{HTTP:X-Forwarded-Port}]
# Full path for redirect
RewriteRule .* - [E=SFC_FULLPATH:typo3temp/tx_staticfilecache/%{ENV:SFC_PROTOCOL}_%{ENV:SFC_HOST}_%{ENV:SFC_PORT}%{ENV:SFC_URI}/index]
# Extension (Order: br, gzip, default)
RewriteRule .* - [E=SFC_EXT:]
RewriteCond %{HTTP:Accept-Encoding} br [NC]
RewriteRule .* - [E=SFC_EXT:.br]
RewriteCond %{ENV:SFC_ROOT}/%{ENV:SFC_FULLPATH}%{ENV:SFC_EXT} !-f
RewriteRule .* - [E=SFC_EXT:]
RewriteCond %{ENV:SFC_EXT} ^$
RewriteCond %{HTTP:Accept-Encoding} gzip [NC]
RewriteRule .* - [E=SFC_EXT:.gz]
RewriteCond %{ENV:SFC_EXT} ^\.gz$
RewriteCond %{ENV:SFC_ROOT}/%{ENV:SFC_FULLPATH}%{ENV:SFC_EXT} !-f
RewriteRule .* - [E=SFC_EXT:]
# Write Extension to SFC_FULLPATH
RewriteRule .* - [E=SFC_FULLPATH:%{ENV:SFC_FULLPATH}%{ENV:SFC_EXT}]
### Begin: StaticFileCache (main) ####
# We only redirect URI's without query strings
RewriteCond %{QUERY_STRING} ^$
# It only makes sense to do the other checks if a static file actually exists.
RewriteCond %{ENV:SFC_ROOT}/%{ENV:SFC_FULLPATH} -f
# NO frontend or backend user is logged in. Logged in users may see different
# information than anonymous users. But the anonymous version is cached. So
# don't show the anonymous version to logged in users.
RewriteCond %{HTTP_COOKIE} !staticfilecache [NC]
# We only redirect GET requests
RewriteCond %{REQUEST_METHOD} GET
# Rewrite the request to the static file.
RewriteRule .* %{ENV:SFC_ROOT}/%{ENV:SFC_FULLPATH} [L]
# Do not allow direct call the cache entries
RewriteCond %{ENV:SFC_URI} ^/typo3temp/tx_staticfilecache/.*
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule .* - [F,L]
# Handle application cache
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^.*\.sfc$ %{ENV:CWD}index.php?eID=sfc_manifest [QSA,L]
### Begin: StaticFileCache (options) ####
# Set proper content type and encoding for gzipped html.
<FilesMatch "\.gzip$">
SetEnv no-gzip 1
SetEnv no-brotli 1
<IfModule mod_headers.c>
Header set Content-Encoding gzip
</IfModule>
</FilesMatch>
<FilesMatch "\.gz$">
SetEnv no-gzip 1
SetEnv no-brotli 1
<IfModule mod_headers.c>
Header set Content-Encoding gzip
</IfModule>
</FilesMatch>
<FilesMatch "\.br$">
SetEnv no-gzip 1
SetEnv no-brotli 1
<IfModule mod_headers.c>
Header set Content-Encoding br
</IfModule>
</FilesMatch>
# if there are same problems with ForceType, please try the AddType alternative
# Set proper content type gzipped html
<FilesMatch "\.html\.gzip$">
ForceType text/html
# AddType "text/html" .gzip
</FilesMatch>
<FilesMatch "\.xml\.gzip$">
ForceType text/xml
# AddType "text/xml" .gzip
</FilesMatch>
<FilesMatch "\.rss\.gzip$">
ForceType text/xml
# AddType "text/xml" .gzip
</FilesMatch>
<FilesMatch "\.html\.gz$">
ForceType text/html
# AddType "text/html" .gz
</FilesMatch>
<FilesMatch "\.xml\.gz$">
ForceType text/xml
# AddType "text/xml" .gz
</FilesMatch>
<FilesMatch "\.rss\.gz$">
ForceType text/xml
# AddType "text/xml" .gz
</FilesMatch>
<FilesMatch "\.html\.br$">
ForceType text/html
# AddType "text/html" .br
</FilesMatch>
<FilesMatch "\.xml\.br$">
ForceType text/xml
# AddType "text/xml" .br
</FilesMatch>
<FilesMatch "\.rss\.br$">
ForceType text/xml
# AddType "text/xml" .br
</FilesMatch>
# Avoid .br files being delivered with Content-Language: br headers
<IfModule mod_mime.c>
RemoveLanguage .br
</IfModule>
### End: StaticFileCache ###
# If the file/symlink/directory does not exist => Redirect to index.php. # If the file/symlink/directory does not exist => Redirect to index.php.
# For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'. # For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'.