|
| 1 | +--TEST-- |
| 2 | +Bug #77200 (imagecropauto(…, GD_CROP_SIDES) crops left but not right) |
| 3 | +--SKIPIF-- |
| 4 | +<?php |
| 5 | +if (!extension_loaded('gd')) die('skip gd extension not available'); |
| 6 | +if (!GD_BUNDLED) die('upstream bugfix has not been released'); |
| 7 | +?> |
| 8 | +--FILE-- |
| 9 | +<?php |
| 10 | + |
| 11 | +$orig = imagecreatetruecolor(8, 8); |
| 12 | +$red = imagecolorallocate($orig, 255, 0, 0); |
| 13 | +$green = imagecolorallocate($orig, 0, 255, 0); |
| 14 | +$blue = imagecolorallocate($orig, 0, 0, 255); |
| 15 | + |
| 16 | +imagefilledrectangle($orig, 0, 0, 3, 3, $green); // tl |
| 17 | +imagefilledrectangle($orig, 4, 0, 7, 3, $red); // tr |
| 18 | +imagefilledrectangle($orig, 0, 4, 3, 7, $green); // bl |
| 19 | +imagefilledrectangle($orig, 4, 4, 7, 7, $blue); // br |
| 20 | + |
| 21 | +$cropped = imagecropauto($orig, IMG_CROP_SIDES); |
| 22 | +var_dump(imagesx($cropped)); |
| 23 | + |
| 24 | +imagefilledrectangle($orig, 0, 0, 3, 3, $red); // tl |
| 25 | +imagefilledrectangle($orig, 4, 0, 7, 3, $green); // tr |
| 26 | +imagefilledrectangle($orig, 0, 4, 3, 7, $blue); // bl |
| 27 | +imagefilledrectangle($orig, 4, 4, 7, 7, $green); // br |
| 28 | + |
| 29 | +$cropped = imagecropauto($orig, IMG_CROP_SIDES); |
| 30 | +var_dump(imagesx($cropped)); |
| 31 | + |
| 32 | +?> |
| 33 | +===DONE=== |
| 34 | +--EXPECT-- |
| 35 | +int(4) |
| 36 | +int(4) |
| 37 | +===DONE=== |
0 commit comments