imageresolution_jpeg.phpt 782 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. Set and get image resolution of JPEG images
  3. --EXTENSIONS--
  4. gd
  5. --SKIPIF--
  6. <?php
  7. if (!(imagetypes() & IMG_JPEG)) die('skip JPEG support not available');
  8. ?>
  9. --FILE--
  10. <?php
  11. $filename = __DIR__ . DIRECTORY_SEPARATOR . 'imageresolution_jpeg.jpeg';
  12. $exp = imagecreate(100, 100);
  13. imagecolorallocate($exp, 255, 0, 0);
  14. imageresolution($exp, 71);
  15. imagejpeg($exp, $filename);
  16. $act = imagecreatefromjpeg($filename);
  17. var_dump(imageresolution($act));
  18. imageresolution($exp, 71, 299);
  19. imagejpeg($exp, $filename);
  20. $act = imagecreatefromjpeg($filename);
  21. var_dump(imageresolution($act));
  22. ?>
  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. --CLEAN--
  37. <?php
  38. @unlink(__DIR__ . DIRECTORY_SEPARATOR . 'imageresolution_jpeg.jpeg');
  39. ?>