PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Images » Image_Transform » Bug #4111

Unable to create a new true color image @ImageCreateTrueColor()

Details

Submitted2005-04-10 10:14 UTC
Fromwebmaster at detectomania dot com
Assignedjausions
StatusClosed
PackageImage_Transform
PHP Version5.0.0
OSLinux Debian
Roadmaps(Not assigned)

Comments

[2005-04-10 10:14 UTC] webmaster at detectomania dot com

Description:
------------
Image_Transform 0.2 beta

in driver GD.php line 332.

Don´t Create a new true color image, because It can´t detect if the function "ImageCreateTrueColor" exists.

//if(@ImageCreateTrueColor()){

I suggest replace it with this line:

if(function_exists('ImageCreateTrueColor')){

[2005-04-10 19:35 UTC] webmaster at detectomania dot com

hello again and sorry for my bad english. The bug exactly is in the "if" conditions that fails in PHP5 (bad counted parameters), not exactly in the "ImageCreateTrueColor()" function, because "if" statement doesn´t return TRUE as it should do because PHP5 comes with gd2 support.

I have solved it with the "function_exists()".

best regards
Ricardo.

My code suggested:

if(function_exists('ImageCreateTrueColor')){
$new_img =ImageCreateTrueColor($new_x,$new_y);
} else {
$new_img =ImageCreate($new_x,$new_y);
}

if(function_exists('ImageCopyResampled')){
ImageCopyResampled($new_img, $this->imageHandle, 0, 0, 0, 0, $new_x, $new_y, $this->img_x, $this->img_y);
} else {
ImageCopyResized($new_img, $this->imageHandle, 0, 0, 0, 0, $new_x, $new_y, $this->img_x, $this->img_y);
}