Browse Source

Make sure we have a resource before measuring its size

tags/v8.1RC2
Olivier Paroz 9 years ago
parent
commit
3d0a523217
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      lib/private/image.php

+ 5
- 1
lib/private/image.php View File

@@ -982,10 +982,14 @@ class OC_Image implements \OCP\IImage {
* @return bool
*/
public function scaleDownToFit($maxWidth, $maxHeight) {
if (!$this->valid()) {
$this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
return false;
}
$widthOrig = imageSX($this->resource);
$heightOrig = imageSY($this->resource);

if ($widthOrig > $maxWidth || $heightOrig >$maxHeight) {
if ($widthOrig > $maxWidth || $heightOrig > $maxHeight) {
return $this->fitIn($maxWidth, $maxHeight);
}


Loading…
Cancel
Save