X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FObject%2FImage.php;h=4645a8678a59fd1e330614315a364dfb01005a07;hb=d936cc5a5c2755a0056ff12a297bf0fa25dc6bf1;hp=d69b01ad4d9e016180cca7916f2d4178116b2565;hpb=122ad0af14f046c2462a03fe33967dc41abfc8b5;p=friendica.git diff --git a/src/Object/Image.php b/src/Object/Image.php index d69b01ad4d..4645a8678a 100644 --- a/src/Object/Image.php +++ b/src/Object/Image.php @@ -541,7 +541,12 @@ class Image do { // FIXME - implement horizontal bias for scaling as in following GD functions // to allow very tall images to be constrained only horizontally. - $this->image->scaleImage($dest_width, $dest_height); + try { + $this->image->scaleImage($dest_width, $dest_height); + } catch (Exception $e) { + // Imagick couldn't use the data + return false; + } } while ($this->image->nextImage()); // These may not be necessary anymore @@ -570,6 +575,21 @@ class Image return true; } + /** + * Convert a GIF to a PNG to make it static + */ + public function toStatic() + { + if ($this->type != 'image/gif') { + return; + } + + if ($this->isImagick()) { + $this->type == 'image/png'; + $this->image->setFormat('png'); + } + } + /** * @param integer $max maximum * @param integer $x x coordinate