File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2097,9 +2097,8 @@ private static function create_thumbnail(object $options) : ?string {
20972097 $ thumbnail_file = $ tmp_dir . '/thumbnail/ ' . $ filename . '.jpg ' ;
20982098
20992099 // convert based on mime type
2100- $ mime = mime_content_type ($ target_path );
2101- $ ar_mime = explode ('/ ' , $ mime );
2102- $ file_type = $ ar_mime [0 ] ?? null ;
2100+ $ finfo = new finfo (FILEINFO_MIME_TYPE );
2101+ $ mime = $ finfo ->file ($ target_path );
21032102
21042103 switch (true ) {
21052104
@@ -2115,15 +2114,15 @@ private static function create_thumbnail(object $options) : ?string {
21152114 ]);
21162115 break ;
21172116
2118- case ($ file_type === 'image ' ):
2117+ case (strpos ( $ mime , 'image/ ' )=== 0 ):
21192118 ImageMagick::convert ((object )[
21202119 'source_file ' => $ target_path ,
21212120 'target_file ' => $ thumbnail_file ,
21222121 'thumbnail ' => true
21232122 ]);
21242123 break ;
21252124
2126- case ($ file_type === 'video ' ):
2125+ case (strpos ( $ mime , 'video/ ' )=== 0 ):
21272126 Ffmpeg::create_posterframe ((object )[
21282127 'timecode ' => '10 ' , // like '10'
21292128 'src_file ' => $ target_path ,
You can’t perform that action at this time.
0 commit comments