Added method to decide if the file should be inlinable
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
c56affd663
commit
96191a5e93
1 changed files with 21 additions and 0 deletions
|
@ -25,4 +25,25 @@ class StorageHelper
|
||||||
return Storage::disk($disk)->download($filename);
|
return Storage::disk($disk)->download($filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function allowSafeInline($file_with_path) {
|
||||||
|
|
||||||
|
$allowed_inline = [
|
||||||
|
'pdf',
|
||||||
|
'svg',
|
||||||
|
'jpg',
|
||||||
|
'gif',
|
||||||
|
'svg',
|
||||||
|
'avif',
|
||||||
|
'webp',
|
||||||
|
'png',
|
||||||
|
];
|
||||||
|
|
||||||
|
if (in_array(pathinfo($file_with_path, PATHINFO_EXTENSION), $allowed_inline)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue