Version 4.7.6
This commit is contained in:
1 parent
8ba7d43898
commit
7b7404e741
1085 files changed
+30590
-7837
No files matched your search
@@ -158,6 +158,35 @@ class _Imagemagick extends \IPS\Image
|
||||
$this->setDimensions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize to maximum
|
||||
*
|
||||
* @param int|NULL $maxWidth Max Width (in pixels) or NULL
|
||||
* @param int|NULL $maxHeight Max Height (in pixels) or NULL
|
||||
* @param bool $retainRatio If TRUE, the image will keep it's current width/height ratio rather than being squashed
|
||||
* @return bool Returns TRUE if it actually resized, or FALSE if it wasn't necessary
|
||||
*/
|
||||
public function resizeToMax( $maxWidth=NULL, $maxHeight=NULL, $retainRatio=TRUE )
|
||||
{
|
||||
/* If we want to strip exif, we need to process this image regardless of size */
|
||||
if( ! \IPS\Settings::i()->imagick_strip_exif )
|
||||
{
|
||||
return parent::resizeToMax( $maxWidth, $maxHeight, $retainRatio );
|
||||
}
|
||||
|
||||
/* If the image is smaller, let's "resize" it keeping the same dimensions, so it runs via the __toString method */
|
||||
if( ( $maxWidth == NULL or $this->width < $maxWidth ) and ( $maxHeight == NULL or $this->height < $maxHeight ) )
|
||||
{
|
||||
$this->resize( $this->width, $this->height );
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return parent::resizeToMax( $maxWidth, $maxHeight, $retainRatio );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Crop to a given width and height (will attempt to downsize first)
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user