Skip to content
Snippets Groups Projects
Commit cb5b07a6 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

stock images: copy uploaded file if image width is smaller than target width, fixes #4377

Closes #4377

Merge request studip/studip!3183
parent 2aa22a3d
No related branches found
No related tags found
No related merge requests found
...@@ -20,13 +20,14 @@ final class Scaler ...@@ -20,13 +20,14 @@ final class Scaler
{ {
$image = $this->createImage($stockImage); $image = $this->createImage($stockImage);
$width = imagesx($image); $width = imagesx($image);
if ($width < $targetWidth) { if ($width < $targetWidth) {
return false; $scaledImage = $image;
} else {
$scaledImage = imagescale($image, $targetWidth);
imagedestroy($image);
} }
$scaledImage = imagescale($image, $targetWidth);
imagedestroy($image);
return $this->storeImage($stockImage, $scaledImage, $sizeName); return $this->storeImage($stockImage, $scaledImage, $sizeName);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment