File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -285,11 +285,11 @@ public function getFilesWithInfo($path)
285285 }
286286
287287 $ thumb_path = $ this ->getThumbPath ($ file_name );
288- $ image_path = $ this ->getCurrentPath ($ file_name );
288+ $ file_path = $ this ->getCurrentPath ($ file_name );
289289 if (File::exists ($ thumb_path )) {
290290 $ thumb_url = $ this ->getThumbUrl ($ file_name ) . '?timestamp= ' . filemtime ($ thumb_path );
291- } elseif (! $ this ->isImageToThumb ( $ image_path )) {
292- $ thumb_url = $ this ->getFileUrl ($ file_name );
291+ } elseif ($ this ->isValidImageType ( $ file_path )) {
292+ $ thumb_url = $ this ->getFileUrl ($ file_name ) . ' ?timestamp= ' . filemtime ( $ file_path ) ;
293293 } else {
294294 $ thumb_url = null ;
295295 }
@@ -342,6 +342,18 @@ public function isImageToThumb($file)
342342 return true ;
343343 }
344344
345+ public function isValidImageType ($ file )
346+ {
347+ $ mine_type = $ this ->getFileType ($ file );
348+ $ valid_image_mimetypes = config ('lfm.valid_image_mimetypes ' );
349+
350+ if (in_array ($ mine_type , $ valid_image_mimetypes )) {
351+ return true ;
352+ }
353+
354+ return false ;
355+ }
356+
345357 public function getFileType ($ file )
346358 {
347359 if ($ file instanceof UploadedFile) {
You can’t perform that action at this time.
0 commit comments