Skip to content
Snippets Groups Projects

Issue #3281606: Rendering duplicate images when the original images have the same name but different extension

Open Issue #3281606: Rendering duplicate images when the original images have the same name but different extension
3 files
+ 18
36
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -107,26 +107,8 @@ class ImageStyleDownloadController extends FileDownloadController {
$image_uri = $scheme . '://' . $target;
if ($webp_wanted = preg_match('/\.webp$/', $image_uri)) {
$destination = $this->webp->getWebpDestination($image_uri, '@directory@filename');
$possible_image_uris = [$destination];
// Try out the different possible sources for a webp image.
$extensions = [
'.jpg',
'.jpeg',
'.png',
];
foreach ($extensions as $extension) {
$possible_image_uris[] = str_replace('.webp', mb_strtoupper($extension), $image_uri);
$possible_image_uris[] = str_replace('.webp', $extension, $image_uri);
}
foreach ($possible_image_uris as $possible_image_uri) {
if (file_exists($possible_image_uri)) {
$image_uri = $possible_image_uri;
break;
}
}
// Drop the webp extension.
$image_uri = $this->webp->getWebpDestination($image_uri, '@directory@filename');
}
// Don't try to generate file if source is missing.
Loading