mirror of
https://github.com/php/php-src.git
synced 2026-03-30 12:13:02 +02:00
PNG allows identical images to be stored differently what makes nearly all tests checking the MD5 hash of the PNG representation fail with external libgd. For now, we use the GD format instead, which doesn't allow for such differences. Of course, this md5() checking should be replaced by a image diffing feature in the long run.
27 lines
611 B
PHP
27 lines
611 B
PHP
--TEST--
|
|
Testing imagerectangle() of GD library
|
|
--CREDITS--
|
|
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
|
#testfest PHPSP on 2009-06-30
|
|
--SKIPIF--
|
|
<?php
|
|
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
// Create a image
|
|
$image = imagecreatetruecolor( 100, 100 );
|
|
|
|
// Draw a rectangle
|
|
imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
|
|
|
ob_start();
|
|
imagegd( $image );
|
|
$img = ob_get_contents();
|
|
ob_end_clean();
|
|
|
|
echo md5(base64_encode($img));
|
|
|
|
?>
|
|
--EXPECT--
|
|
e7f8ca8c63fb08b248f3ed6435983aed
|