2020-01-26 13:19:35 +00:00
|
|
|
<?php declare(strict_types=1);
|
2007-12-06 03:06:59 +00:00
|
|
|
|
2019-05-28 17:59:38 +01:00
|
|
|
class FlashFileHandler extends DataHandlerExtension
|
|
|
|
{
|
2020-02-23 18:37:22 +00:00
|
|
|
protected $SUPPORTED_EXT = ["swf"];
|
2019-06-25 15:17:13 -05:00
|
|
|
|
2020-02-23 18:37:22 +00:00
|
|
|
protected function media_check_properties(MediaCheckPropertiesEvent $event): void
|
|
|
|
{
|
|
|
|
$event->image->lossless = true;
|
|
|
|
$event->image->video = true;
|
|
|
|
$event->image->image = false;
|
2019-06-25 15:17:13 -05:00
|
|
|
|
2020-02-23 18:37:22 +00:00
|
|
|
$info = getimagesize($event->file_name);
|
|
|
|
if ($info) {
|
|
|
|
$event->image->width = $info[0];
|
|
|
|
$event->image->height = $info[1];
|
2019-06-25 15:17:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-14 12:34:53 -05:00
|
|
|
protected function create_thumb(string $hash, string $type): bool
|
2019-05-28 17:59:38 +01:00
|
|
|
{
|
2019-06-24 10:05:16 -05:00
|
|
|
if (!Media::create_thumbnail_ffmpeg($hash)) {
|
2019-06-15 11:18:52 -05:00
|
|
|
copy("ext/handle_flash/thumb.jpg", warehouse_path(Image::THUMBNAIL_DIR, $hash));
|
2019-06-09 13:22:48 -05:00
|
|
|
}
|
2019-05-28 17:59:38 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function check_contents(string $tmpname): bool
|
|
|
|
{
|
|
|
|
$fp = fopen($tmpname, "r");
|
|
|
|
$head = fread($fp, 3);
|
|
|
|
fclose($fp);
|
2020-02-23 18:14:15 +00:00
|
|
|
return in_array($head, ["CWS", "FWS"]);
|
2019-05-28 17:59:38 +01:00
|
|
|
}
|
2007-12-06 03:06:59 +00:00
|
|
|
}
|