1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-17 20:11:46 +02:00

changed to more robust filename creation

This commit is contained in:
horst-n
2019-04-25 00:21:09 +02:00
parent a5a101a456
commit f3f4e427b0
2 changed files with 72 additions and 8 deletions

View File

@@ -412,8 +412,9 @@ class ImageSizerEngineGD extends ImageSizerEngine {
*/
protected function imSaveWebP($im, $filename, $quality = 90) {
if(!function_exists('imagewebp')) return false;
$newBasename = str_replace(array('.jpg', '.jpeg', '.png', '.gif'), '.webp', basename($filename));
return imagewebp($im, dirname($filename) . '/' . $newBasename, $quality);
$path_parts = pathinfo($filename);
$webpFilename = $path_parts['dirname'] . '/' . $path_parts['filename'] . '.webp';
return imagewebp($im, $webpFilename, $quality);
}
/**