SAAS-1032: Shows with missing show art on disk can't be edited
This commit is contained in:
parent
3592eceb22
commit
17074e5f70
1 changed files with 15 additions and 5 deletions
|
@ -344,11 +344,21 @@ class Application_Service_ShowFormService
|
||||||
* - the data URI representation of the image
|
* - the data URI representation of the image
|
||||||
*/
|
*/
|
||||||
private function imagePathToDataUri($path) {
|
private function imagePathToDataUri($path) {
|
||||||
ob_start();
|
$imageData = null;
|
||||||
header("Content-type: image/*");
|
$bytesRead = 0;
|
||||||
readfile($path);
|
try {
|
||||||
$imageData = base64_encode(ob_get_contents());
|
ob_start();
|
||||||
ob_end_clean();
|
header("Content-type: image/*");
|
||||||
|
$bytesRead = @readfile($path);
|
||||||
|
$imageData = base64_encode(ob_get_contents());
|
||||||
|
ob_end_clean();
|
||||||
|
if ($bytesRead === FALSE) {
|
||||||
|
$imageData = null;
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Logging::error("Failed to read image: " . $path);
|
||||||
|
$imageData = null;
|
||||||
|
}
|
||||||
// return the data URI - data:{mime};base64,{data}
|
// return the data URI - data:{mime};base64,{data}
|
||||||
return ($imageData === null || $imageData === '') ?
|
return ($imageData === null || $imageData === '') ?
|
||||||
'' : 'data: '.mime_content_type($path).';base64,'.$imageData;
|
'' : 'data: '.mime_content_type($path).';base64,'.$imageData;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue