1--TEST--
2Test imagecolorset() function : basic functionality
3--CREDITS--
4Erick Belluci Tedeschi <erickbt86 [at] gmail [dot] com>
5#testfest PHPSP on 2009-06-20
6--SKIPIF--
7<?php
8if (!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
18imagecolorallocate($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
24imagecolorset($im, $bg, 0, 0, 255);
25
26// Get output and generate md5 hash
27ob_start();
28imagepng($im, null, 9);
29$result_image = ob_get_contents();
30ob_end_clean();
31echo md5(base64_encode($result_image));
32imagedestroy($im);
33?>
34--EXPECT--
356f2002aafb57b2d275fad6a6258d7476
36