imagesavealpha crashing upload

Found a bug? Tell us!!
Post Reply
foosel
Posts: 1
Joined: Mon Feb 28, 2005 1:00 am
Location: Darmstadt, Germany

imagesavealpha crashing upload

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: imagesavealpha crashing upload

Post by garvinhicking »

Thanks a lot! You are right, the function does not exist for PHP < 4.3.2. I committed your patch!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply