fix(images): set default mimetype if none is specified when getting size info

This commit is contained in:
Yassine Doghri 2022-01-19 12:09:12 +00:00
parent 17fb29b209
commit 6e4acc64ad
2 changed files with 6 additions and 6 deletions

View File

@ -33,14 +33,16 @@ class Image extends BaseMedia
{
helper('media');
$extension = $this->file_extension;
$mimetype = $this->file_mimetype;
foreach ($this->sizes as $name => $size) {
if (array_key_exists('extension', $size)) {
$extension = $size['extension'];
} else {
$extension = $this->file_extension;
}
if (array_key_exists('mimetype', $size)) {
$mimetype = $size['mimetype'];
} else {
$mimetype = $this->file_mimetype;
}
$this->{$name . '_path'} = $this->file_directory . '/' . $this->file_name . '_' . $name . '.' . $extension;
$this->{$name . '_url'} = media_base_url($this->{$name . '_path'});

View File

@ -30,9 +30,7 @@ if (! function_exists('write_audio_file_tags')) {
$tagwriter->tagformats = ['id3v2.4'];
$tagwriter->tag_encoding = $TextEncoding;
$cover = new File(media_path($episode->cover->id3_path));
$APICdata = file_get_contents($cover->getRealPath());
$APICdata = file_get_contents(media_path($episode->cover->id3_path));
// TODO: variables used for podcast specific tags
// $podcastUrl = $episode->podcast->link;
@ -73,7 +71,7 @@ if (! function_exists('write_audio_file_tags')) {
'picturetypeid' => 2,
'data' => $APICdata,
'description' => 'cover',
'mime' => $cover->getMimeType(),
'mime' => $episode->cover->file_mimetype,
];
$tagwriter->tag_data = $TagData;