Closed sashabeep closed 3 years ago
UPD: Moved redirect rule to the top of .htaccess file and conversation seems to be ok but i'm getting reports instead of images despite the 'show-report' option is set true or false or commented
Weird.
I have many changes with regards to the .htaccess rules in the upcoming release. And some handy buttons for running self-tests / diagnosis. Lets see how this all acts in the next release.
0.15.0 is out. Can you tell me if it works in 0.15.0?
Still getting broken images with html content-type. Direct link shows the images, .webp copy is not creating, redirect doesnt work.
Can you paste in the output after pressing the "Live test" buttons ? Perhaps you simply need to change some file permissions.
Hmmm...
Fatal error: Uncaught Error: Call to undefined method WebPConvert\WebPConvert::convertAndServe() in /****/webp-on-demand.php:16 Stack trace: #0 {main} thrown in /****/webp-on-demand.php on line 16
Installed using composer
webp-on-demand.php
<?php
require 'vendor/autoload.php'; // Make sure to point this correctly
use WebPConvert\WebPConvert;
$source = $_GET['source']; // Absolute file path to source file. Comes from the .htaccess
$destination = $source . '.webp'; // Store the converted images besides the original images (other options are available!)
$options = [
// UNCOMMENT NEXT LINE, WHEN YOU ARE UP AND RUNNING!
'show-report' => false // Show a conversion report instead of serving the converted image.
// More options available!
];
WebPConvert::convertAndServe($source, $destination, $options);
Sorry, ignore my last comment. I thought you were using the Wordpress plugin. There is of course no "test" buttons in this library...
The problem was perhaps simply that you were using the tutorial for 1.3 but using WebPConvert 2.0. The "convertAndServe" method was renamed to "serveConverted" in 2.0.
in my htaccess:
When i try to open any .jpg file hothing happens with on-the-fly conversion, just jpg displays. But when i call /webp-on-demand.php?source=my/jpg/file.jpg script is reporting that
and creates my/jpg/file.jpg.webp alongside with original one
Why are redirect to conversion and created image doesn't work? I'm using lite speed web server The other rewrite rules in .htaccess works as expected. What am i missing?