Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Transparent GIF's lost their transparency...

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 3046 Views
  • CriaturaCreativaStudio
    Avatar
    Community Member
    73 Posts

    Transparent GIF's lost their transparency... Link to this post

    Hello there!

    I'm using transparent gifs on a website.
    Anyway i use these files on the page, they lost the alpha channel, and the effect looks horrible.
    I'm not resizing the files with the CMS, and i've tried to insert them directly on the content to double check this issue, and the problem persists...

    any ideas?

    Regards

    Eduardo

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Transparent GIF's lost their transparency... Link to this post

    even if you just insert an image straight in the content editor it will still recreate it in GD so SilverStripe can edit it as far as I know sadly. You could try experiment with writing the link to the image in the HTML source but I still think it will try a 'resize' it even if you dont change the sizes.

    Dont know if this is a bug in Silverstripe or the implementation of tinymce as to why it does this.

  • Sigurd
    Avatar
    Forum Moderator
    628 Posts

    Re: Transparent GIF's lost their transparency... Link to this post

    It is

    a) a bug that the image is resampled even when you don't resize the image. This needs to be solved. This also affects animated GIFS. I think this is solved but needs to be merged into a new release; http://open.silverstripe.com/ticket/1985

    b) a bug that the image looses its alpha information when you resample the image. This might be a limitation of GD. Anyone care to investigate, or file a bug at open.silverstripe.com?

  • artlung
    Avatar
    Community Member
    10 Posts

    Re: Transparent GIF's lost their transparency... Link to this post

    I have seen this bug, and I went around the bug by using PNGs - though if I had an animated GIF I'd be pretty upset about it.

    I wonder if there could be a setting settable in the image chooser to select "no resample" or something like that.

  • poblom
    Avatar
    Community Member
    25 Posts
  • CodeGuerrilla
    Avatar
    Community Member
    105 Posts

    Re: Transparent GIF's lost their transparency... Link to this post

    I had to fix the same issue on one of our in-house CMS, unfortunately I don't know the internals of SS well enough or have time to patch this myself the basic idea below:

    Maintain GIF transparency by getting/setting transparent color from source image and copying to destination image

    // read gif information to find transparency
    $fp = fopen($file_path,"rb");
    $result = fread($fp,13);
    $gif_version = substr($result,3,3);
    $gif_colorFlag = ord(substr($result,10,1)) >> 7;
    fclose($fp);
    if($gif_version == '89a' && $gif_colorFlag == 1) {
    $colorTransparent = imagecolortransparent($src_img);
    imagepalettecopy($image,$src_img);
    imagefill($image, 0, 0, $colorTransparent);
    imagecolortransparent($image, $colorTransparent);
    }

    If a dev can give this a try and patch SS that be great!

  • CodeGuerrilla
    Avatar
    Community Member
    105 Posts

    Re: Transparent GIF's lost their transparency... Link to this post

    [Bump!] This is still an issue with 2.2.3 can a dev look into this please...

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Transparent GIF's lost their transparency... Link to this post

    CodeGuerrilla, 2.2.3 has no other features then the security fix. I believe a fix is in trunk (to be 2.3) so try that out. If is still broken in that check open.silverstripe.com for an open ticket for it. If one doesn't exist, create one. This helps keep track of bugs like this for the dev team.

    3046 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.