imageresolution_jpeg.phpt 855 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Set and get image resolution of JPEG images
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded('gd')) die('skip gd extension not available');
  6. if (!(imagetypes() & IMG_JPEG)) die('skip JPEG support not available');
  7. ?>
  8. --FILE--
  9. <?php
  10. $filename = __DIR__ . DIRECTORY_SEPARATOR . 'imageresolution_jpeg.jpeg';
  11. $exp = imagecreate(100, 100);
  12. imagecolorallocate($exp, 255, 0, 0);
  13. imageresolution($exp, 71);
  14. imagejpeg($exp, $filename);
  15. $act = imagecreatefromjpeg($filename);
  16. var_dump(imageresolution($act));
  17. imageresolution($exp, 71, 299);
  18. imagejpeg($exp, $filename);
  19. $act = imagecreatefromjpeg($filename);
  20. var_dump(imageresolution($act));
  21. ?>
  22. ===DONE===
  23. --EXPECT--
  24. array(2) {
  25. [0]=>
  26. int(71)
  27. [1]=>
  28. int(71)
  29. }
  30. array(2) {
  31. [0]=>
  32. int(71)
  33. [1]=>
  34. int(299)
  35. }
  36. ===DONE===
  37. --CLEAN--
  38. <?php
  39. @unlink(__DIR__ . DIRECTORY_SEPARATOR . 'imageresolution_jpeg.jpeg');
  40. ?>