bug73291.phpt 734 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Bug #73291 (imagecropauto() $threshold differs from external libgd)
  3. --EXTENSIONS--
  4. gd
  5. --FILE--
  6. <?php
  7. $src = imagecreatetruecolor(255, 255);
  8. $white = imagecolorallocate($src, 255, 255, 255);
  9. imagefilledrectangle($src, 0, 0, 254, 254, $white);
  10. for ($i = 254; $i > 0; $i--) {
  11. $color = imagecolorallocate($src, $i, $i, $i);
  12. imagefilledellipse($src, 127, 127, $i, $i, $color);
  13. }
  14. foreach ([0.1, 0.5, 1.0, 10.0] as $threshold) {
  15. $dst = imagecropauto($src, IMG_CROP_THRESHOLD, $threshold, $white);
  16. if ($dst !== false) {
  17. printf("size: %d*%d\n", imagesx($dst), imagesy($dst));
  18. } else {
  19. echo "cropped to zero size\n";
  20. }
  21. }
  22. ?>
  23. --EXPECT--
  24. size: 247*247
  25. size: 237*237
  26. size: 229*229
  27. size: 175*175