Open 01Kuzma opened 1 year ago
Do the webp images exist beside the original files on the disk? They have the same name but .webp appended.
Also, try running the following command to generate the missing webp files:
php artisan responsive-images:convert --include=storage/app
Strange things happen in my localhost, it's blocking my stylesheets "Blocked loading mixed active content". I have to investigate what is causing this after minor changes.
On the other hand, on prod version, I can't run a PHP commands. It seems, that files are not created:
You could check the live prod's console here
add a var_dump
for the $baseDir
and $source
variables here and check the response in your browser console if the returned paths are valid:
https://github.com/OFFLINE-GmbH/oc-responsive-images-plugin/blob/develop/webp.php#L31
I've added it just right now to prod (live):
$baseDir = env('RESPONSIVE_IMAGES_BASE_DIR', __DIR__ . '/../../..'); $source = realpath($baseDir . $source); echo"SOURCE:::"; var_dump($baseDir); var_dump($source); $destination = $source . '.webp';
Cleared the cache, but it doesn't give any text output...
What is weird, on localhost (Windows) now some of the pictures are loaded, but some of them are not.
All the image requests return No input file specified.
, this means the webp.php is never loaded and something is wrong with the rewrite rule.
Check your server's access and error logs and see if you can find more details there.
all error logs are empty, except access.log
.
That;s from localhost:
127.0.0.1 - - [26/Apr/2023:15:15:08 +0300] "GET / HTTP/1.1" 200 10085
127.0.0.1 - - [26/Apr/2023:15:15:08 +0300] "GET /storage/app/uploads/public/5ff/33c/ea6/thumb_146_600_600_0_0_auto.jpg HTTP/1.1" 302 162
127.0.0.1 - - [26/Apr/2023:15:15:08 +0300] "GET /storage/app/uploads/public/60c/f79/a4b/thumb_401_600_600_0_0_auto.jpg HTTP/1.1" 302 162
127.0.0.1 - - [26/Apr/2023:15:15:09 +0300] "POST /andreishilov/up/config/ HTTP/1.1" 200 193
127.0.0.1 - - [26/Apr/2023:15:15:08 +0300] "GET /404 HTTP/1.1" 404 280
127.0.0.1 - - [26/Apr/2023:15:15:09 +0300] "GET /404 HTTP/1.1" 404 280
Even with standard winter's .htaccess
+ ResponsiveImages
the results are the same :/
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
##
## You may need to uncomment the following line for some hosting environments,
## if you have installed to a subdirectory, enter the name here also.
##
# RewriteBase /
##
## Uncomment following lines to force HTTPS.
##
# RewriteCond %{HTTPS} off
# RewriteRule (.*) https://%{SERVER_NAME}/$1 [L,R=301]
##
## Paths explicitly blocked from being handled by the server
##
RewriteRule ^bootstrap/.* index.php [L,NC]
RewriteRule ^config/.* index.php [L,NC]
RewriteRule ^vendor/.* index.php [L,NC]
RewriteRule ^storage/cms/.* index.php [L,NC]
RewriteRule ^storage/logs/.* index.php [L,NC]
RewriteRule ^storage/framework/.* index.php [L,NC]
RewriteRule ^storage/temp/protected/.* index.php [L,NC]
RewriteRule ^storage/app/uploads/protected/.* index.php [L,NC]
##
## Paths explicitly handled by the server
##
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !/.well-known/*
RewriteCond %{REQUEST_FILENAME} !/storage/app/uploads/public/.*
RewriteCond %{REQUEST_FILENAME} !/storage/app/media/.*
RewriteCond %{REQUEST_FILENAME} !/storage/app/resized/.*
RewriteCond %{REQUEST_FILENAME} !/storage/temp/public/.*
RewriteCond %{REQUEST_FILENAME} !/themes/.*/(assets|resources)/.*
RewriteCond %{REQUEST_FILENAME} !/plugins/.*/(assets|resources)/.*
RewriteCond %{REQUEST_FILENAME} !/modules/.*/(assets|resources)/.*
RewriteRule !^index.php index.php [L,NC]
##
## Block all PHP files, except index
##
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} \.php$
RewriteRule !^index.php index.php [L,NC]
##
## Standard routes
##
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
## START OFFLINE.ResponsiveImages - webp-rewrite
# DO NOT REMOVE THESE LINES
<IfModule mod_setenvif.c>
# Vary: Accept for all the requests to jpeg and png
SetEnvIf Request_URI "\.(jpe?g|png)$" REQUEST_image
</IfModule>
<ifModule mod_rewrite.c>
# If the Browser supports WebP images, and the .webp file exists, use it.
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_URI} ^/?storage/.*\.(jpe?g|png)
RewriteCond %{REQUEST_FILENAME}.webp -f
RewriteRule ^/?(.*)$ $1.webp [NC,T=image/webp,END]
# If the Browser supports WebP images, and the .webp file does not exist, generate it.
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_URI} ^/?storage/.*\.(jpe?g|png)
RewriteCond %{REQUEST_FILENAME}\.webp !-f
RewriteRule ^/?(.*)$ plugins/offline/responsiveimages/webp.php?path=$1 [NC,END]
</ifModule>
<IfModule mod_headers.c>
Header append Vary Accept env=REQUEST_image
</IfModule>
<IfModule mod_mime.c>
AddType image/webp .webp
</IfModule>
## END OFFLINE.ResponsiveImages - webp-rewrite
Hi! I need help with
.htaccess
rules.As I wrote earlier in the past issues, I'm running Winter CMS on PHP 8.1 with
oc-responsive-images-plugin
and just updatedoc-speedy-plugin
.The problem is with
responsive images
and.htacees
, oncewebp rules
are active the part of all images disappears and I get a 404 error in my console. If I comment out thewebp
part everything works. Am I doing something wrong or it's a bug?Thank you!
Here is my full
.htaccess
: