Changed data uri method to return empty string instead of malformed uri when given an incorrect path (oddball case)

This commit is contained in:
Duncan Sommerville 2014-09-18 10:34:38 -04:00
parent 096556fa74
commit 323f53d6ac
1 changed files with 3 additions and 2 deletions

View File

@ -308,8 +308,9 @@ class Application_Service_ShowFormService
readfile($path);
$imageData = base64_encode(ob_get_contents());
ob_end_clean();
// Format the image SRC: data:{mime};base64,{data};
return 'data: '.mime_content_type($path).';base64,'.$imageData;
// return the data URI - data:{mime};base64,{data}
return ($imageData === null || $imageData === '') ?
'' : 'data: '.mime_content_type($path).';base64,'.$imageData;
}
private function populateFormLive($form)