1--TEST-- 2Different types of thumbnailing 3--SKIPIF-- 4<?php require_once dirname(__FILE__) . '/skipif.inc'; ?> 5--FILE-- 6<?php 7echo "--- Source Image: 400x200, Imagick::thumbnailImage( 100, null, false )\n"; 8$imagick = new Imagick(); 9$imagick->newImage( 400, 200, "white" ); 10$imagick->thumbnailImage( 100, null, false ); 11$g = $imagick->getImageGeometry(); 12echo "{$g['width']}x{$g['height']}\n"; 13 14echo "--- Source Image: 400x200, Imagick::thumbnailImage( null, 100, false )\n"; 15$imagick = new Imagick(); 16$imagick->newImage( 400, 200, "white" ); 17$imagick->thumbnailImage( null, 100, false ); 18$g = $imagick->getImageGeometry(); 19echo "{$g['width']}x{$g['height']}\n"; 20 21echo "--- Source Image: 400x200, Imagick::thumbnailImage( 100, 100, false )\n"; 22$imagick = new Imagick(); 23$imagick->newImage( 400, 200, "white" ); 24$imagick->thumbnailImage( 100, 100, false); 25$g = $imagick->getImageGeometry(); 26echo "{$g['width']}x{$g['height']}\n"; 27 28echo "--- Source Image: 400x200, Imagick::thumbnailImage( null, null, false )\n"; 29$imagick = new Imagick(); 30$imagick->newImage( 400, 200, "white" ); 31try 32{ 33 $imagick->thumbnailImage( null, null, false ); 34 echo "FAILED TEST\n"; 35} 36catch ( ImagickException $e ) 37{ 38 echo $e->getMessage() . "\n"; 39} 40 41echo "--- Source Image: 400x200, Imagick::thumbnailImage( 100, 100, true )\n"; 42$imagick = new Imagick(); 43$imagick->newImage( 400, 200, "white" ); 44$imagick->thumbnailImage( 100, 100, true ); 45$g = $imagick->getImageGeometry(); 46echo "{$g['width']}x{$g['height']}\n"; 47 48echo "--- Source Image: 400x200, Imagick::thumbnailImage( 100, null, true )\n"; 49$imagick = new Imagick(); 50$imagick->newImage( 400, 200, "white" ); 51try 52{ 53 $imagick->thumbnailImage( 100, null, true ); 54 echo "FAILED TEST\n"; 55} 56catch ( ImagickException $e ) 57{ 58 echo $e->getMessage() . "\n"; 59} 60 61echo "--- Source Image: 400x200, Imagick::thumbnailImage( null, 100, true )\n"; 62$imagick = new Imagick(); 63$imagick->newImage( 400, 200, "white" ); 64try 65{ 66 $imagick->thumbnailImage( null, 100, true ); 67 echo "FAILED TEST\n"; 68} 69catch ( ImagickException $e ) 70{ 71 echo $e->getMessage() . "\n"; 72} 73 74echo "--- Source Image: 400x200, Imagick::thumbnailImage( null, null, true )\n"; 75$imagick = new Imagick(); 76$imagick->newImage( 400, 200, "white" ); 77try 78{ 79 $imagick->thumbnailImage( null, null, true ); 80 echo "FAILED TEST\n"; 81} 82catch ( ImagickException $e ) 83{ 84 echo $e->getMessage() . "\n"; 85} 86 87// Legacy version 88$imagick = new Imagick(); 89$imagick->newImage(2961, 2592, "white" ); 90$imagick->thumbnailImage(300, 0, false, false, true); 91 92if ($imagick->getImageWidth() != 300) { 93 echo "Error in height for 2961, 2592: actual is ".$image->getImageWidth()." not 300.".PHP_EOL; 94} 95if ($imagick->getImageHeight() != 262) { 96 echo "Error in height for 2961, 2592: actual is ".$image->getImageHeight()." not 262.".PHP_EOL; 97} 98 99// Correct version 100$imagick = new Imagick(); 101$imagick->newImage(2961, 2592, "white" ); 102$imagick->thumbnailImage(300, 0); 103 104if ($imagick->getImageWidth() != 300) { 105 echo "Error in height for 2961, 2592: actual is ".$image->getImageWidth()." not 300.".PHP_EOL; 106} 107if ($imagick->getImageHeight() != 263) { 108 echo "Error in height for 2961, 2592: actual is ".$image->getImageHeight()." not 263.".PHP_EOL; 109} 110 111?> 112--EXPECTF-- 113--- Source Image: 400x200, Imagick::thumbnailImage( 100, null, false ) 114100x50 115--- Source Image: 400x200, Imagick::thumbnailImage( null, 100, false ) 116200x100 117--- Source Image: 400x200, Imagick::thumbnailImage( 100, 100, false ) 118100x100 119--- Source Image: 400x200, Imagick::thumbnailImage( null, null, false ) 120Invalid image geometry 121--- Source Image: 400x200, Imagick::thumbnailImage( 100, 100, true ) 122100x50 123--- Source Image: 400x200, Imagick::thumbnailImage( 100, null, true ) 124Invalid image geometry 125--- Source Image: 400x200, Imagick::thumbnailImage( null, 100, true ) 126Invalid image geometry 127--- Source Image: 400x200, Imagick::thumbnailImage( null, null, true ) 128Invalid image geometry 129