63b2601e67
Changed mime type map to deal with the reality that certain file types have multiple extensions and/or multiple mime types, as well as constants supporting all of the data. Created new functions using the updated mime type map to resolve mime types and extensions. Updated various items around the project that determine mime/extension to take advantage of the new functions.
28 lines
807 B
PHP
28 lines
807 B
PHP
<?php declare(strict_types=1);
|
|
|
|
class MP3FileHandler extends DataHandlerExtension
|
|
{
|
|
protected $SUPPORTED_MIME = [MIME_TYPE_MP3];
|
|
|
|
protected function media_check_properties(MediaCheckPropertiesEvent $event): void
|
|
{
|
|
$event->image->audio = true;
|
|
$event->image->video = false;
|
|
$event->image->lossless = false;
|
|
$event->image->image = false;
|
|
$event->image->width = 0;
|
|
$event->image->height = 0;
|
|
// TODO: ->length = ???
|
|
}
|
|
|
|
protected function create_thumb(string $hash, string $type): bool
|
|
{
|
|
copy("ext/handle_mp3/thumb.jpg", warehouse_path(Image::THUMBNAIL_DIR, $hash));
|
|
return true;
|
|
}
|
|
|
|
protected function check_contents(string $tmpname): bool
|
|
{
|
|
return get_mime($tmpname) === MIME_TYPE_MP3;
|
|
}
|
|
}
|