Page 1 of 1

imagesavealpha crashing upload

Posted: Mon Feb 28, 2005 1:28 am
by foosel
Hi there,

I just stumbled across a nasty bug in s9y_20050221 and could verify it as well in s9y_20050227, concerning the image upload in the media library. The call to imagesavealpha in functions_images.inc.php causes the stop of the scripts execution, therefore only the image gets uploaded, but neither a thumbnail nor a corresponding entry to the database is made, making it impossible to delete the file using the media library.
This happened on a host running PHP 4.3.1.

I fixed it for me by changing

Code: Select all

    /* Attempt to copy transparency information, this really only works for PNG */
    imagealphablending($out, false);
    imagesavealpha($out, true);
to

Code: Select all

   /* Attempt to copy transparency information, this really only works for PNG */
	if (function_exists("imagesavealpha")) {
		imagealphablending($out, false);
		imagesavealpha($out, true);
	}
(include/functions_images.inc.php, line something around 760)

HTH and regards,
Gina

Re: imagesavealpha crashing upload

Posted: Mon Feb 28, 2005 3:15 pm
by garvinhicking
Thanks a lot! You are right, the function does not exist for PHP < 4.3.2. I committed your patch!

Regards,
Garvin