mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 09:42:09 -04:00
fix: resolve PHP deprecation of imagedestroy
> Prior to PHP 8.0.0, imagedestroy() freed any memory associated with the image resource. > As of 8.0.0, the GD extension uses objects instead of resources, and objects cannot be explicitly closed. With PHP 8.5 this is deprecated and causes a deprecation warning! Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
2b7415ef4d
commit
2a5fc73ca9
2 changed files with 0 additions and 9 deletions
|
|
@ -265,12 +265,7 @@ class ImageManager {
|
|||
}
|
||||
}
|
||||
$tmpFile = $newTmpFile;
|
||||
imagedestroy($outputImage);
|
||||
} catch (\Exception $e) {
|
||||
if (isset($outputImage) && is_resource($outputImage) || $outputImage instanceof \GdImage) {
|
||||
imagedestroy($outputImage);
|
||||
}
|
||||
|
||||
$this->logger->debug($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -508,7 +508,6 @@ class Image implements IImage {
|
|||
if ($res) {
|
||||
if (imagealphablending($res, true)) {
|
||||
if (imagesavealpha($res, true)) {
|
||||
imagedestroy($this->resource);
|
||||
$this->resource = $res;
|
||||
return true;
|
||||
} else {
|
||||
|
|
@ -926,7 +925,6 @@ class Image implements IImage {
|
|||
$res = imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig);
|
||||
if ($res === false) {
|
||||
$this->logger->debug(__METHOD__ . '(): Error re-sampling process image', ['app' => 'core']);
|
||||
imagedestroy($process);
|
||||
return false;
|
||||
}
|
||||
return $process;
|
||||
|
|
@ -988,7 +986,6 @@ class Image implements IImage {
|
|||
$this->logger->debug('Image->centerCrop, Error re-sampling process image ' . $width . 'x' . $height, ['app' => 'core']);
|
||||
return false;
|
||||
}
|
||||
imagedestroy($this->resource);
|
||||
$this->resource = $process;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1009,7 +1006,6 @@ class Image implements IImage {
|
|||
return false;
|
||||
}
|
||||
$result = $this->cropNew($x, $y, $w, $h);
|
||||
imagedestroy($this->resource);
|
||||
$this->resource = $result;
|
||||
return $this->valid();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue