Commit 6e4acc64 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

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

parent 17fb29b2
Pipeline #1207 failed with stages
in 6 minutes and 16 seconds
......@@ -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'});
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment