From b6b72984d24409d5c53b92d3199f9dde7da7045f Mon Sep 17 00:00:00 2001 From: Alexandre Teles Date: Mon, 22 Aug 2016 15:12:46 -0300 Subject: [PATCH] Create SVG thumbnails Just to make #222 able to merge again --- bl-kernel/ajax/uploader.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bl-kernel/ajax/uploader.php b/bl-kernel/ajax/uploader.php index 74206383..281dddaf 100644 --- a/bl-kernel/ajax/uploader.php +++ b/bl-kernel/ajax/uploader.php @@ -47,11 +47,20 @@ if($type=='profilePicture') else { // Generate the thumbnail $Image = new Image(); - $Image->setImage(PATH_TMP.'original'.'.'.$fileExtension, THUMBNAILS_WIDTH, THUMBNAILS_HEIGHT, 'crop'); - $Image->saveImage(PATH_UPLOADS_THUMBNAILS.$tmpName, THUMBNAILS_QUALITY, true); + + //Handling all other formats than svg + if (strcasecmp($fileExtension, 'svg') != 0) { + $Image->setImage(PATH_TMP.'original'.'.'.$fileExtension, THUMBNAILS_WIDTH, THUMBNAILS_HEIGHT, 'crop'); + $Image->saveImage(PATH_UPLOADS_THUMBNAILS.$tmpName, THUMBNAILS_QUALITY, true); + } // Move the original to the upload folder. rename(PATH_TMP.'original'.'.'.$fileExtension, PATH_UPLOADS.$tmpName); + + //If it is a svg file, just save a copy in thumbnail-folder + if (strcasecmp($fileExtension, 'svg') == 0) { + symlink(PATH_UPLOADS.$tmpName, PATH_UPLOADS_THUMBNAILS.$tmpName); + } } // Remove the Bludit temporary file.