1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-12 01:50:48 +01:00

Fix custom thumb_ext for ImageMagick convert

When using ImageMagick's convert tool, the output defaults to the input format if no file extension or format is specified.
The temp file currently has no extension, so a $config['thumb_ext'] value has no effect on the image.
By appending the thumb_ext to the temp output file, it will convert the image to the intended format.

You can see this issue present on lainchan, where thumbnails have a .png filename but are not really PNG files when the input is a .jpg, for example.
This commit is contained in:
discomrade 2021-06-23 11:52:29 +00:00 committed by GitHub
parent fd9a3c07dd
commit a752a3930c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -311,8 +311,8 @@ class ImageConvert extends ImageBase {
$this->destroy();
}
$this->temp = tempnam($config['tmp'], 'convert');
$this->temp = tempnam($config['tmp'], 'convert') . ($config['thumb_ext'] == '' ? '.' . $config['thumb_ext'] : '');
$config['thumb_keep_animation_frames'] = (int)$config['thumb_keep_animation_frames'];
if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) {