Corrupt Cover Art prohibits mp3 upload

Don't throw an exception on corrupted cover art image data in upload. The order of processing needs to be the other way around.
This commit is contained in:
Thomas Göttgens 2020-07-18 16:35:00 +02:00 committed by GitHub
parent cf84f82eae
commit 82d3530777
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 6 deletions

View File

@ -394,16 +394,18 @@ class FileDataHelper {
$im = @imagecreatefromjpeg($get_cont);
}
if ($size){
$im = imagescale($im , $size);
}
if(!$im) {
// if one of those bombs, create an error image instead
if (!$im) {
$im = imagecreatetruecolor(150, 30);
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
imagestring($im, 1, 5, 5, 'Error loading ' . $imgname, $tc);
imagestring($im, 1, 5, 5, 'Error loading ' . $converted_filename, $tc);
}
// scale if appropriate
if ($size){
$im = imagescale($im , $size);
}
$img = $im;