File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -311,7 +311,7 @@ function getFileInfo(\Symfony\Component\Finder\SplFileInfo $file)
311
311
{
312
312
$ path = request ('path ' );
313
313
314
- return [
314
+ $ info = [
315
315
'name ' => $ file ->getFilename (),
316
316
'path ' => sanitizePath ($ path .'/ ' .$ file ->getRelativePathname ()),
317
317
'is_dir ' => $ file ->isDir (),
@@ -325,6 +325,22 @@ function getFileInfo(\Symfony\Component\Finder\SplFileInfo $file)
325
325
'extension ' => strtolower ($ file ->getExtension ()),
326
326
'last_modified ' => $ file ->getMTime (),
327
327
];
328
+
329
+ if ($ file ->isFile ()) {
330
+ $ mime = mimeTypes ()->guessMimeType ($ file ->getRealPath ());
331
+ if (preg_match ('#^image/# ' , $ mime )) {
332
+ $ dimension = getimagesize ($ file ->getRealPath ());
333
+ $ info ['image_info ' ] = [
334
+ 'width ' => $ dimension ['0 ' ],
335
+ 'height ' => $ dimension ['1 ' ],
336
+ 'bits ' => $ dimension ['bits ' ],
337
+ 'channels ' => $ dimension ['channels ' ],
338
+ 'mime ' => $ dimension ['mime ' ],
339
+ ];
340
+ }
341
+ }
342
+
343
+ return $ info ;
328
344
}
329
345
330
346
/**
You can’t perform that action at this time.
0 commit comments