diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2016-07-24 14:14:57 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2017-01-04 14:55:02 +0100 |
commit | 500b496f8ee345443d6101d854dd9b0197956212 (patch) | |
tree | 6525f69092df3101d4a67af8f7f0eaefcb2bc5fe /ext/gd/tests/imagecreatefromstring_bmp.phpt | |
parent | d83828540e7b88f99dd8d5ed4c295e62056e5044 (diff) | |
download | php-git-500b496f8ee345443d6101d854dd9b0197956212.tar.gz |
Implement #69606: Support BMPs (added in GD 2.1.0)
We add PHP bindings for libgd's features to read and write BMP files, which
are available as of libgd 2.1.0.
As PHP's bundled libgd doesn't yet include the respective features of the
external libgd, we add these.
Diffstat (limited to 'ext/gd/tests/imagecreatefromstring_bmp.phpt')
-rw-r--r-- | ext/gd/tests/imagecreatefromstring_bmp.phpt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/ext/gd/tests/imagecreatefromstring_bmp.phpt b/ext/gd/tests/imagecreatefromstring_bmp.phpt new file mode 100644 index 0000000000..a0c8b3e57e --- /dev/null +++ b/ext/gd/tests/imagecreatefromstring_bmp.phpt @@ -0,0 +1,28 @@ +--TEST-- +imagecreatefromstring() - BMP format +--SKIPIF-- +<?php +if (!extension_loaded('gd')) die('skip ext/gd required'); +if (!(imagetypes() & IMG_BMP)) die('skip BMP support required'); +?> +--FILE-- +<?php +// create an image from a BMP string representation +$bmp = "\x42\x4D\x3E\x00\x00\x00\x00\x00\x00\x00\x3E\x00\x00\x00\x28\x00" + . "\x00\x00\x0A\x00\x00\x00\x0A\x00\x00\x00\x01\x00\x08\x00\x01\x00" + . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00" + . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF\xFF\x00\x0A\x00" + . "\x00\x00\x0A\x00\x00\x00\x07\x00\x01\x01\x01\x00\x00\x00\x06\x00" + . "\x01\x01\x01\x00\x02\x00\x00\x00\x05\x00\x01\x01\x01\x00\x03\x00" + . "\x00\x00\x04\x00\x01\x01\x01\x00\x04\x00\x00\x00\x03\x00\x01\x01" + . "\x01\x00\x05\x00\x00\x00\x02\x00\x01\x01\x01\x00\x06\x00\x00\x00" + . "\x0A\x00\x00\x00\x0A\x00\x00\x00\x00\x01"; +$im = imagecreatefromstring($bmp); + +include_once __DIR__ . '/func.inc'; +test_image_equals_file(__DIR__ . '/imagecreatefromstring_bmp.png', $im); +?> +===DONE=== +--EXPECT-- +The images are equal. +===DONE=== |