GD imagedestroy() is deprected and noop since PHP version 8.0

This commit is contained in:
Mario
2025-12-16 11:16:28 +00:00
parent 2eb51233f6
commit e5d0ef79ef
4 changed files with 6 additions and 13 deletions

View File

@@ -63,10 +63,13 @@ class PhotoGd extends PhotoDriver {
return;
}
/**
* @brief GD imagedestroy() is deprected and noop since PHP version 8.0
*
* @return void
*/
protected function destroy() {
if($this->is_valid()) {
imagedestroy($this->image);
}
return;
}
/**
@@ -95,8 +98,6 @@ class PhotoGd extends PhotoDriver {
imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127)); // fill with alpha
imagecopyresampled($dest, $this->image, 0, 0, 0, 0, $dest_width, $dest_height, $width, $height);
if($this->image)
imagedestroy($this->image);
$this->image = $dest;
$this->setDimensions();
@@ -142,8 +143,6 @@ class PhotoGd extends PhotoDriver {
imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127)); // fill with alpha
imagecopyresampled($dest, $this->image, 0, 0, $x, $y, $maxx, $maxy, $w, $h);
if($this->image)
imagedestroy($this->image);
$this->image = $dest;
$this->setDimensions();

View File

@@ -54,9 +54,6 @@ class Epubthumb {
imagecopyresampled($dest, $image, 0, 0, 0, 0, $width, $height, $srcwidth, $srcheight);
imagejpeg($dest, "{$file}.thumb");
imagedestroy($image);
imagedestroy($dest);
}
}

View File

@@ -36,7 +36,6 @@ class Mp3audio {
imagealphablending($dest, false);
imagesavealpha($dest, true);
imagecopyresampled($dest, $image, 0, 0, 0, 0, $width, $height, $srcwidth, $srcheight);
imagedestroy($image);
imagejpeg($dest,dbunescbin($attach['content']) . '.thumb');
}
}

View File

@@ -29,13 +29,11 @@ class PhotodriverTest extends UnitTestCase {
case 'png':
$im = imagecreatetruecolor(10, 10);
imagepng($im, $tmp);
imagedestroy($im);
break;
case 'jpeg':
default:
$im = imagecreatetruecolor(10, 10);
imagejpeg($im, $tmp);
imagedestroy($im);
break;
}
return $tmp;