Version 4.7.6

This commit is contained in:
Neo committed 2025-12-19 16:05:19 -08:00
1 parent 8ba7d43898
commit 7b7404e741
1085 files changed
+30590 -7837

No files matched your search

+7 -2
View File
@@ -218,8 +218,10 @@ class _Gd extends \IPS\Image
{
case 'gif':
imagealphablending( $newImage, FALSE );
// PHP8 fix, see https://stackoverflow.com/questions/3874533/what-could-cause-a-color-index-out-of-range-error-for-imagecolorsforindex
$transindex = imagecolortransparent( $this->image );
if( $transindex >= 0 )
$palletsize = imagecolorstotal($this->image);
if( $transindex >= 0 AND $transindex < $palletsize )
{
$transcol = @imagecolorsforindex( $this->image, $transindex );
$transindex = imagecolorallocatealpha( $newImage, $transcol['red'], $transcol['green'], $transcol['blue'], 127 );
@@ -292,8 +294,11 @@ class _Gd extends \IPS\Image
{
case 'gif':
imagealphablending( $newImage, FALSE );
// PHP8 fix, see https://stackoverflow.com/questions/3874533/what-could-cause-a-color-index-out-of-range-error-for-imagecolorsforindex
$transindex = imagecolortransparent( $this->image );
if( $transindex >= 0 )
$palletsize = imagecolorstotal($this->image);
if( $transindex >= 0 AND $transindex < $palletsize )
{
$transcol = @imagecolorsforindex( $this->image, $transindex );
$transindex = imagecolorallocatealpha( $newImage, $transcol['red'], $transcol['green'], $transcol['blue'], 127 );
+29
View File
@@ -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)
*