1--TEST--
2Test Imagick, resizeImage
3--SKIPIF--
4<?php
5$imageMagickRequiredVersion=0x675;
6require_once(dirname(__FILE__) . '/skipif.inc');
7?>
8--FILE--
9<?php
10
11$filterType = 22;
12$width = 200;
13$height = 200;
14$blur = 1;
15$bestFitSettings = array(0, 1);
16$cropZoom = 1;
17
18function resizeImage($width, $height, $filterType, $blur, $bestFit, $cropZoom) {
19    //The blur factor where &gt; 1 is blurry, &lt; 1 is sharp.
20    $imagick = new \Imagick();
21    $imagick->newPseudoImage(640, 480, "magick:logo");
22
23    $imagick->resizeImage($width, $height, $filterType, $blur, $bestFit);
24
25    $cropWidth = $imagick->getImageWidth();
26    $cropHeight = $imagick->getImageHeight();
27
28    if ($cropZoom) {
29        $newWidth = $cropWidth / 2;
30        $newHeight = $cropHeight / 2;
31
32        $imagick->cropimage(
33            $newWidth,
34            $newHeight,
35            (int)(($cropWidth - $newWidth) / 2),
36            (int)(($cropHeight - $newHeight) / 2)
37        );
38
39        $imagick->scaleimage(
40            $imagick->getImageWidth() * 4,
41            $imagick->getImageHeight() * 4
42        );
43    }
44
45
46    $bytes = $imagick->getImageBlob();
47    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
48}
49
50foreach ($bestFitSettings as $bestFit) {
51	resizeImage($width, $height, $filterType, $blur, $bestFit, $cropZoom);
52}
53echo "Ok";
54?>
55--EXPECTF--
56Ok