bug77200.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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('skip upstream bugfix has not been released');
  7. ?>
  8. --FILE--
  9. <?php
  10. $orig = imagecreatetruecolor(8, 8);
  11. $red = imagecolorallocate($orig, 255, 0, 0);
  12. $green = imagecolorallocate($orig, 0, 255, 0);
  13. $blue = imagecolorallocate($orig, 0, 0, 255);
  14. imagefilledrectangle($orig, 0, 0, 3, 3, $green); // tl
  15. imagefilledrectangle($orig, 4, 0, 7, 3, $red); // tr
  16. imagefilledrectangle($orig, 0, 4, 3, 7, $green); // bl
  17. imagefilledrectangle($orig, 4, 4, 7, 7, $blue); // br
  18. $cropped = imagecropauto($orig, IMG_CROP_SIDES);
  19. var_dump(imagesx($cropped));
  20. imagefilledrectangle($orig, 0, 0, 3, 3, $red); // tl
  21. imagefilledrectangle($orig, 4, 0, 7, 3, $green); // tr
  22. imagefilledrectangle($orig, 0, 4, 3, 7, $blue); // bl
  23. imagefilledrectangle($orig, 4, 4, 7, 7, $green); // br
  24. $cropped = imagecropauto($orig, IMG_CROP_SIDES);
  25. var_dump(imagesx($cropped));
  26. ?>
  27. ===DONE===
  28. --EXPECT--
  29. int(4)
  30. int(4)
  31. ===DONE===