Annotation of embedaddon/php/ext/gd/tests/imagecolorset_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test imagecolorset() function : basic functionality
3: --CREDITS--
4: Erick Belluci Tedeschi <erickbt86 [at] gmail [dot] com>
5: #testfest PHPSP on 2009-06-20
6: --SKIPIF--
7: <?php
8: if (!extension_loaded('gd')) {
9: die('skip gd extension is not loaded');
10: }
11: ?>
12: --FILE--
13: <?php
14: // Create a 300x100 image
15: $im = imagecreate(300, 100);
16:
17: // Set the background to be red
18: imagecolorallocate($im, 255, 0, 0);
19:
20: // Get the color index for the background
21: $bg = imagecolorat($im, 0, 0);
22:
23: // Set the backgrund to be blue
24: imagecolorset($im, $bg, 0, 0, 255);
25:
26: // Get output and generate md5 hash
27: ob_start();
28: imagepng($im, null, 9);
29: $result_image = ob_get_contents();
30: ob_end_clean();
31: echo md5(base64_encode($result_image));
32: imagedestroy($im);
33: ?>
34: --EXPECT--
35: 6f2002aafb57b2d275fad6a6258d7476
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>