@@ -288,12 +288,12 @@ public function objectPresenter($item)
288
288
289
289
$ thumb_path = $ this ->getThumbPath ($ item_name );
290
290
$ 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 )) {
294
292
$ 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 );
295
295
} else {
296
- $ thumb_url = null ;
296
+ $ thumb_url = $ this -> getFileUrl ( $ item_name ) . ' ?timestamp= ' . filemtime ( $ file_path ) ;
297
297
}
298
298
} else {
299
299
$ extension = strtolower (File::extension ($ item_name ));
@@ -335,28 +335,12 @@ public function fileIsImage($file)
335
335
return starts_with ($ mime_type , 'image ' );
336
336
}
337
337
338
- public function isImageToThumb ($ file )
338
+ public function imageShouldNotHaveThumb ($ file )
339
339
{
340
340
$ mine_type = $ this ->getFileType ($ file );
341
341
$ noThumbType = ['image/gif ' , 'image/svg+xml ' ];
342
342
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 );
360
344
}
361
345
362
346
public function getFileType ($ file )
0 commit comments