Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve logic when images will be converted #28213

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/theming/lib/ImageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ public function updateImage(string $key, string $tmpFile) {
throw new \Exception('Unsupported image type');
}

if ($key === 'background' && strpos($detectedMimeType, 'image/svg') === false && strpos($detectedMimeType, 'image/gif') === false) {
// Optimize the image since some people may upload images that will be
// either to big or are not progressive rendering.
// Convert the background image if the size is bigger than 10 MB or if it is no background image and the size is bigger than 2 MB
if (($key === 'background' && filesize($tmpFile) > 10 * 1024 * 1024) || ($key !== 'background' && filesize($tmpFile) > 2 * 1024 * 1024)) {

$newImage = @imagecreatefromstring(file_get_contents($tmpFile));

// Preserve transparency
Expand Down