S
S
seljmov22019-10-17 07:39:53
PHP
seljmov2, 2019-10-17 07:39:53

Why does Imagick crash when I try to resize an image?

Good morning.
Installed Imagick on a local xampp server like in the video:
The problem is that any Imagick functions I have tested work, but neither cropThumbnailImage(1080, 600) nor thumbnailImage(800, 800) does . What could be the problem? Even tried to catch an error through try catch, but there is no result.
Here is the whole code:

$image = $_SERVER['DOCUMENT_ROOT'].'/voland.png';

try {
  $img = new Imagick($image);
  $img->thumbnailImage(800, 800);
  $img->writeImage($_SERVER['DOCUMENT_ROOT'].'/new_voland.png');
  $img->clear();
  $img->destroy();
} catch (Exception $e) {
  var_dump($e);
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
seljmov2, 2019-10-17
@seljmov2

Solved a problem.
Instead of cropThumbnailImage(1080, 600) and thumbnailImage(800, 800)
Use - adaptiveResizeImage(1024,768)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question