????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.191 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/gd/tests/ |
Upload File : |
--TEST--
Test imagecolorallocate() function : usage variations - passing RED, GREEN, BLUE values more than 255
--SKIPIF--
<?php
if(!extension_loaded('gd')) {
die('skip gd extension is not loaded');
}
if(!function_exists('imagecreatetruecolor')) {
die('skip imagecreatetruecolor function is not available');
}
?>
--FILE--
<?php
/* Prototype : int imagecolorallocate(resource im, int red, int green, int blue)
* Description: Allocate a color for an image
* Source code: ext/gd/gd.c
*/
echo "*** Testing imagecolorallocate() : usage variations ***\n";
$values = array(
//Decimal integera data
"Decimal 256" => 256,
// octal integer data
"Octal 0400" => 0400,
// hexa-decimal integer data
"Hexa-decimal 0x100" => 0x100
);
// loop through each element of the array for blue
foreach($values as $key => $value) {
echo "\n--$key--\n";
//Need to be created every time to get expected return value
$im_palette = imagecreate(200, 200);
$im_true_color = imagecreatetruecolor(200, 200);
var_dump( imagecolorallocate($im_palette, $value, $value, $value) );
var_dump( imagecolorallocate($im_true_color, $value, $value, $value) );
};
?>
===DONE===
--EXPECTF--
*** Testing imagecolorallocate() : usage variations ***
--Decimal 256--
int(0)
int(16843008)
--Octal 0400--
int(0)
int(16843008)
--Hexa-decimal 0x100--
int(0)
int(16843008)
===DONE===