1--TEST-- 2Testing imagetruecolortopalette() of GD library 3--CREDITS-- 4Rafael Dohms <rdohms [at] gmail [dot] com> 5--SKIPIF-- 6<?php 7 if (!extension_loaded("gd")) die("skip GD not present"); 8 if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible"); 9?> 10--FILE-- 11<?php 12// Create a 200x100 image 13$image = imagecreatetruecolor(200, 100); 14$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); 15$black = imagecolorallocate($image, 0x00, 0x00, 0x00); 16 17// Set the background to be white 18imagefilledrectangle($image, 0, 0, 299, 99, $white); 19 20// Set the line thickness to 5 21imagesetthickness($image, 5); 22 23// Draw the rectangle 24imagerectangle($image, 14, 14, 185, 85, $black); 25 26ob_start(); 27imagepng($image, null, 9); 28$img = ob_get_contents(); 29ob_end_clean(); 30 31echo md5(base64_encode($img)); 32?> 33--EXPECT-- 3493c3077f1bdc372cd0b0db96db282985