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.

Archive /

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


Reply


8 Posts   3180 Views

Avatar
CriaturaCreativaStudio

Community Member, 73 Posts

31 August 2008 at 12:44pm

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

Avatar
Willr

Forum Moderator, 5513 Posts

31 August 2008 at 2:10pm

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.

Avatar
Sigurd

Forum Moderator, 628 Posts

4 September 2008 at 12:18pm

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

Avatar
artlung

Community Member, 10 Posts

23 September 2008 at 5:49am

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.

Avatar
poblom

Community Member, 25 Posts

23 September 2008 at 7:19am

Try this: [url]http://silverstripe.com/site-builders-forum/flat/9740#post12044[/url]

It works!

/PO

Avatar
CodeGuerrilla

Community Member, 105 Posts

23 September 2008 at 4:28pm

Edited: 12/11/2008 3:18pm

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!

Avatar
CodeGuerrilla

Community Member, 105 Posts

12 November 2008 at 3:19pm

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

Avatar
Willr

Forum Moderator, 5513 Posts

12 November 2008 at 3:22pm

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.