@@ -288,12 +288,12 @@ public function objectPresenter($item)
288288
289289 $ thumb_path = $ this ->getThumbPath ($ item_name );
290290 $ file_path = $ this ->getCurrentPath ($ item_name );
291- if (File::exists ($ thumb_path )) {
292- $ thumb_url = $ this ->getThumbUrl ($ item_name ) . '?timestamp= ' . filemtime ($ thumb_path );
293- } elseif ($ this ->isValidImageType ($ file_path )) {
291+ if ($ this ->imageShouldNotHaveThumb ($ file_path )) {
294292 $ thumb_url = $ this ->getFileUrl ($ item_name ) . '?timestamp= ' . filemtime ($ file_path );
293+ } elseif (File::exists ($ thumb_path )) {
294+ $ thumb_url = $ this ->getThumbUrl ($ item_name ) . '?timestamp= ' . filemtime ($ thumb_path );
295295 } else {
296- $ thumb_url = null ;
296+ $ thumb_url = $ this -> getFileUrl ( $ item_name ) . ' ?timestamp= ' . filemtime ( $ file_path ) ;
297297 }
298298 } else {
299299 $ extension = strtolower (File::extension ($ item_name ));
@@ -335,28 +335,12 @@ public function fileIsImage($file)
335335 return starts_with ($ mime_type , 'image ' );
336336 }
337337
338- public function isImageToThumb ($ file )
338+ public function imageShouldNotHaveThumb ($ file )
339339 {
340340 $ mine_type = $ this ->getFileType ($ file );
341341 $ noThumbType = ['image/gif ' , 'image/svg+xml ' ];
342342
343- if (in_array ($ mine_type , $ noThumbType )) {
344- return false ;
345- }
346-
347- return true ;
348- }
349-
350- public function isValidImageType ($ file )
351- {
352- $ mine_type = $ this ->getFileType ($ file );
353- $ valid_image_mimetypes = config ('lfm.valid_image_mimetypes ' );
354-
355- if (in_array ($ mine_type , $ valid_image_mimetypes )) {
356- return true ;
357- }
358-
359- return false ;
343+ return in_array ($ mine_type , $ noThumbType );
360344 }
361345
362346 public function getFileType ($ file )
0 commit comments