Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
allow a config item to test imagecopyresized
Signed-off-by: nachoparker <[email protected]>
  • Loading branch information
nachoparker committed Jun 28, 2019
commit 9e29455ccebed2e74b5b13716a1ee42e3d5a8172
14 changes: 12 additions & 2 deletions lib/private/legacy/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,12 @@ public function preciseResize(int $width, int $height): bool {
imagesavealpha($process, true);
}

imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig);
$interpolate = (bool)$this->config->getSystemValue('preview_interpolate', false);
if ($interpolate) {
imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig);
} else {
imagecopyresized($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig);
}
if ($process == false) {
$this->logger->error(__METHOD__ . '(): Error re-sampling process image', array('app' => 'core'));
imagedestroy($process);
Expand Down Expand Up @@ -950,7 +955,12 @@ public function centerCrop($size = 0) {
imagesavealpha($process, true);
}

imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $targetWidth, $targetHeight, $width, $height);
$interpolate = (bool)$this->config->getSystemValue('preview_interpolate', false);
if ($interpolate) {
imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $targetWidth, $targetHeight, $width, $height);
} else {
imagecopyresized($process, $this->resource, 0, 0, $x, $y, $targetWidth, $targetHeight, $width, $height);
}
if ($process == false) {
$this->logger->error('OC_Image->centerCrop, Error re-sampling process image ' . $width . 'x' . $height, array('app' => 'core'));
imagedestroy($process);
Expand Down