imagecreatefromstring_bmp.phpt 1.1 KB

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. imagecreatefromstring() - BMP format
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded('gd')) die('skip ext/gd required');
  6. if (!(imagetypes() & IMG_BMP)) die('skip BMP support required');
  7. ?>
  8. --FILE--
  9. <?php
  10. // create an image from a BMP string representation
  11. $bmp = "\x42\x4D\x3E\x00\x00\x00\x00\x00\x00\x00\x3E\x00\x00\x00\x28\x00"
  12. . "\x00\x00\x0A\x00\x00\x00\x0A\x00\x00\x00\x01\x00\x08\x00\x01\x00"
  13. . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00"
  14. . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF\xFF\x00\x0A\x00"
  15. . "\x00\x00\x0A\x00\x00\x00\x07\x00\x01\x01\x01\x00\x00\x00\x06\x00"
  16. . "\x01\x01\x01\x00\x02\x00\x00\x00\x05\x00\x01\x01\x01\x00\x03\x00"
  17. . "\x00\x00\x04\x00\x01\x01\x01\x00\x04\x00\x00\x00\x03\x00\x01\x01"
  18. . "\x01\x00\x05\x00\x00\x00\x02\x00\x01\x01\x01\x00\x06\x00\x00\x00"
  19. . "\x0A\x00\x00\x00\x0A\x00\x00\x00\x00\x01";
  20. $im = imagecreatefromstring($bmp);
  21. include_once __DIR__ . '/func.inc';
  22. test_image_equals_file(__DIR__ . '/imagecreatefromstring_bmp.png', $im);
  23. ?>
  24. ===DONE===
  25. --EXPECT--
  26. The images are equal.
  27. ===DONE===