Support » Plugins and Hacks » [Plugin: NextGEN Gallery] Problems with PNG Transparency thumbnails

[Plugin: NextGEN Gallery] Problems with PNG Transparency thumbnails

Viewing 8 replies - 1 through 8 (of 8 total)

    After much searching for a solution to this and not finding one, I developed my own solution. The following solution works for me and my needs. I dont now know if it hinders operations in areas of the plugin that i havent tested, and it also may not be optimal in terms of speed and/or coding conventions, but it works for me.

    open gd.thumbnail.inc.php and scroll to the bottom of the file
    change the function fastimagecopyresampled to the following:

    function fastimagecopyresampled (&$dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $quality = 5) {
    		$dst_img = imagecreatetruecolor($dst_w, $dst_h);
    		imagealphablending($dst_image, false);
    		$transparent = imagecolorallocatealpha($dst_image, 255, 255, 255, 127);
    		imagefilledrectangle($dst_image, 0, 0, $dst_w, $dst_h, $transparent);
    		imagecopyresampled($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
    	  return true;

    Note: I had a problem with cached images and had to delete and then re-upload my images to eliminate the black background.

    Hope this helps people who are stuck.

    Hi Guys,

    Thanks for the posts…

    Have you had any further issues after applying that patch?

    I only ask because I’m about to pop it into a WPMU & BuddyPress installation…


    Stephen G


    I’ve popped your patch in Oran and so far so good…tranparent .pngs! Yay! 🙂

    I’ll let you know if I find anything, but I’ve played around in the gallery a fair bit since, and for my purposes too, it appears to be mighty fine 🙂

    Many thanks…


    Stephen G

    PS If it’s helpful to anyone, here are my versions:

    WPMU 2.9.2, BuddyPress 1.2.3, BuddyPress Scholar Theme 2.1.6, NextGen 1.5.2

    Thanks for the posts…

    I filed a bug for this at http://plugins.trac.wordpress.org/ticket/1209 , now lets hope it will not take another 9 months to get this into the plugin.

    no way in my wordpress, doesnt work, I follow all you say… any other suggestion?

    As the other thread http://wordpress.org/support/topic/plugin-nextgen-gallery-png-thumbnails-with-transparancy-problem-1?replies=4
    suggests, you can just reupload the thumbs. Not very effecient, but works.


    I don’t get it to work either (even after deleting and re-uploading images, creating new galleries etc).
    Is there anyway someone who got it to work could post the entire code in case I have replaced some lines I shouldnt or left some lines I shouldnt have?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: NextGEN Gallery] Problems with PNG Transparency thumbnails’ is closed to new replies.
Skip to toolbar