Skip to content

Commit 0302d60

Browse files
Merge pull request #61176 from nextcloud/fix/deprecated-85
fix: resolve PHP deprecation of `imagedestroy`
2 parents bb8bc05 + 2a5fc73 commit 0302d60

2 files changed

Lines changed: 0 additions & 9 deletions

File tree

apps/theming/lib/ImageManager.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,7 @@ public function updateImage(string $key, string $tmpFile): string {
265265
}
266266
}
267267
$tmpFile = $newTmpFile;
268-
imagedestroy($outputImage);
269268
} catch (\Exception $e) {
270-
if (isset($outputImage) && is_resource($outputImage) || $outputImage instanceof \GdImage) {
271-
imagedestroy($outputImage);
272-
}
273-
274269
$this->logger->debug($e->getMessage());
275270
}
276271
}

lib/private/Image.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,6 @@ public function fixOrientation(): bool {
508508
if ($res) {
509509
if (imagealphablending($res, true)) {
510510
if (imagesavealpha($res, true)) {
511-
imagedestroy($this->resource);
512511
$this->resource = $res;
513512
return true;
514513
} else {
@@ -926,7 +925,6 @@ public function preciseResizeNew(int $width, int $height): \GdImage|false {
926925
$res = imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig);
927926
if ($res === false) {
928927
$this->logger->debug(__METHOD__ . '(): Error re-sampling process image', ['app' => 'core']);
929-
imagedestroy($process);
930928
return false;
931929
}
932930
return $process;
@@ -988,7 +986,6 @@ public function centerCrop(int $size = 0): bool {
988986
$this->logger->debug('Image->centerCrop, Error re-sampling process image ' . $width . 'x' . $height, ['app' => 'core']);
989987
return false;
990988
}
991-
imagedestroy($this->resource);
992989
$this->resource = $process;
993990
return true;
994991
}
@@ -1009,7 +1006,6 @@ public function crop(int $x, int $y, int $w, int $h): bool {
10091006
return false;
10101007
}
10111008
$result = $this->cropNew($x, $y, $w, $h);
1012-
imagedestroy($this->resource);
10131009
$this->resource = $result;
10141010
return $this->valid();
10151011
}

0 commit comments

Comments
 (0)