WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: NextGEN Gallery] Problems with PNG Transparency thumbnails (9 posts)

  1. kochfede
    Member
    Posted 4 years ago #

    I use NextGen gallery, and when it creates the thumbs of PNG with transparency, by default use a BLACK background, I would like to change it to white at least, I search in lib/gd.thumbnail.inc.php but it is a very messy...
    anyone knows??

    http://wordpress.org/extend/plugins/nextgen-gallery/

  2. oranblackwell
    Member
    Posted 4 years ago #

    THIS SOLUTION UNTESTED IN ALL ENVIRONMENTS!!!

    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);
    		imagesavealpha($dst_image,true);
    		$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.

  3. noShitWFP
    Member
    Posted 4 years ago #

    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...

    Cheers

    Stephen G

  4. noShitWFP
    Member
    Posted 4 years ago #

    @oranblackwell,

    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...

    Cheers

    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

  5. apbabkin@mail.ru
    Member
    Posted 3 years ago #

    @oranblackwell,
    Thanks for the posts...
    Andrey

  6. Sorin
    Member
    Posted 3 years ago #

    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.

  7. kochfede
    Member
    Posted 3 years ago #

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

  8. rumlab
    Member
    Posted 3 years ago #

    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.

    m

  9. 96320
    Member
    Posted 3 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic