dedupe more data handling

This commit is contained in:
Shish
2020-02-23 18:37:22 +00:00
parent 674d3fc6fa
commit b5e9daeab5
7 changed files with 149 additions and 198 deletions

View File

@@ -2,23 +2,18 @@
class FlashFileHandler extends DataHandlerExtension
{
public function onMediaCheckProperties(MediaCheckPropertiesEvent $event)
protected $SUPPORTED_EXT = ["swf"];
protected function media_check_properties(MediaCheckPropertiesEvent $event): void
{
switch ($event->ext) {
case "swf":
$event->image->lossless = true;
$event->image->video = true;
$event->image->lossless = true;
$event->image->video = true;
$event->image->image = false;
$info = getimagesize($event->file_name);
if (!$info) {
return null;
}
$event->image->image = false;
$event->image->width = $info[0];
$event->image->height = $info[1];
break;
$info = getimagesize($event->file_name);
if ($info) {
$event->image->width = $info[0];
$event->image->height = $info[1];
}
}
@@ -30,12 +25,6 @@ class FlashFileHandler extends DataHandlerExtension
return true;
}
protected function supported_ext(string $ext): bool
{
$exts = ["swf"];
return in_array(strtolower($ext), $exts);
}
protected function check_contents(string $tmpname): bool
{
$fp = fopen($tmpname, "r");