Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.


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

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

Transparent GIF's lost their transparency...


8 Posts   3117 Views


31 August 2008 at 12:44pm Community Member, 73 Posts

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?




31 August 2008 at 2:10pm Forum Moderator, 5511 Posts

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.


4 September 2008 at 12:18pm Forum Moderator, 628 Posts

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;

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 :)


23 September 2008 at 5:49am Community Member, 10 Posts

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.


23 September 2008 at 7:19am Community Member, 25 Posts

Try this: [url][/url]

It works!



23 September 2008 at 4:28pm (Last edited: 12 November 2008 3:18pm), Community Member, 105 Posts

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;
if($gif_version == '89a' && $gif_colorFlag == 1) {
$colorTransparent = imagecolortransparent($src_img);
imagefill($image, 0, 0, $colorTransparent);
imagecolortransparent($image, $colorTransparent);

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


12 November 2008 at 3:19pm Community Member, 105 Posts

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


12 November 2008 at 3:22pm Forum Moderator, 5511 Posts

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