don't try and load an empty string as a photo

This commit is contained in:
friendica 2013-04-29 19:52:31 -07:00
parent 641e69ef7f
commit d63de4dbe2
2 changed files with 8 additions and 1 deletions

View File

@ -17,6 +17,9 @@ class photo_gd extends photo_driver {
function load($data, $type) {
$this->valid = false;
if(! $data)
return;
$this->image = @imagecreatefromstring($data);
if($this->image !== FALSE) {
$this->valid = true;

View File

@ -27,6 +27,10 @@ class photo_imagick extends photo_driver {
function load($data, $type) {
$this->valid = false;
$this->image = new Imagick();
if(! $data)
return;
$this->image->readImageBlob($data);
@ -71,9 +75,9 @@ class photo_imagick extends photo_driver {
if((! $quality) || ($quality > 100))
$quality = JPEG_QUALITY;
$this->image->setCompressionQuality($quality);
default:
break;
}
}
}