File tree Expand file tree Collapse file tree 3 files changed +22
-2
lines changed
Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 100100 'image/gif ' ,
101101 'application/pdf ' ,
102102 'text/plain ' ,
103+ 'image/svg+xml ' ,
103104 ],
104105
105106 /*
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ private function proceedSingleUpload($file)
5454
5555 event (new ImageIsUploading ($ new_file_path ));
5656 try {
57- if ($ this ->fileIsImage ($ file )) {
57+ if ($ this ->fileIsImage ($ file ) && $ this -> isImageToThumb ( $ file ) ) {
5858 Image::make ($ file ->getRealPath ())
5959 ->orientate () //Apply orientation from exif data
6060 ->save ($ new_file_path , 90 );
Original file line number Diff line number Diff line change @@ -319,14 +319,33 @@ public function directoryIsEmpty($directory_path)
319319 }
320320
321321 public function fileIsImage ($ file )
322+ {
323+ $ mime_type = $ this ->getFileType ($ file );
324+
325+ return starts_with ($ mime_type , 'image ' );
326+ }
327+
328+ public function isImageToThumb ($ file )
329+ {
330+ $ mine_type = $ this ->getFileType ($ file );
331+ $ noThumbType = ['image/gif ' , 'image/svg+xml ' ];
332+
333+ if (in_array ($ mine_type , $ noThumbType )) {
334+ return false ;
335+ }
336+
337+ return true ;
338+ }
339+
340+ public function getFileType ($ file )
322341 {
323342 if ($ file instanceof UploadedFile) {
324343 $ mime_type = $ file ->getMimeType ();
325344 } else {
326345 $ mime_type = File::mimeType ($ file );
327346 }
328347
329- return starts_with ( $ mime_type, ' image ' ) ;
348+ return $ mime_type ;
330349 }
331350
332351 public function sortFilesAndDirectories ($ arr_items , $ sort_type )
You can’t perform that action at this time.
0 commit comments