We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21778
    • 223 Posts
    I have a bunch of .gif images with a transparent background, but when i upload them to my maxigallery the thumbs get a colored background. Is there anyway to change this?

    Thanks :- )
      • 7923
      • 4,213 Posts
      Nope... The thumbnail class what MaxiGallery uses doesn’t support transparent backgrounds.

      You can see the class in /assets/snippets/maxigallery/watermark/Thumbnail.class.php, if you want to make it support gifs.


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 21778
        • 223 Posts
        Quote from: doze at Sep 22, 2009, 04:54 PM

        Nope... The thumbnail class what MaxiGallery uses doesn’t support transparent backgrounds.

        You can see the class in /assets/snippets/maxigallery/watermark/Thumbnail.class.php, if you want to make it support gifs.

        Okay, thanks for the reply smiley
          • 21778
          • 223 Posts
          Damn, can someone help me with this? I’m not quite sure what to do with the class.

          There must be other people interested in this feature aswell? smiley

          Also, is there any alternative to maxigalley that work with latest modx and support .gif or .png?
            • 30552
            • 75 Posts
            So what determines what color the transparent pixels become?

            Can you easily build in something like GD2’s
            transparent=(color)
            so we can at least control what the transparent color becomes?
              • 30552
              • 75 Posts
              Okay, I’ve made some progress. Right now, it only works for gifs, and it only works for the actual image (not the thumbnail).

              I did it by changing the function that converts GIFs to PNGs. Go to line 406 in maxigallery.class.inc.php, and change
              $dest=imagecreate($src_size[0],$src_size[1]);
              to

              $dest=imagecreate($src_size[0],$src_size[1]);
              //attempt transparency in final PNG (not thumbnail)
              imagecolortransparent($dest,imagecolorallocate($dest, 0, 0, 0));
              imagealphablending($dest,false);
              imagesavealpha($dest,true);


              If I make more progress, I will post. Next step is to recreate this in the Thumbnail.class.php file, which will fix the thumbnail. Also, I currently would not expect this to work for an already transparent .PNG file, since there’s probably a separate area for preprocessing those. Perhaps the author can help a little bit, since it seems the code to maintain transparency is simple. I’m not much of a PHP guy myself, so it’s not easy for me to find the right spots to use the code. Little fixes sometimes take me lots of research time smiley

              EDIT: PNGs upload with transparency intact, but no matter what i do, I cannot get the thumbnails to have transparent backgrounds. I wonder if doze has any insight?