Jump to content

Gif thumbnail issue


Pete
 Share

Recommended Posts

Hi

I think there might be a problem when showing thumbnails in the page editor if they have transparent backgrounds (see attached image).

Basically when an image is resized I don't think it's storing the transparency data. It's been a while since I looked at thumbnailing in PHP and I think you can save that data when thumbnailing gifs, but an easy solution here would be to set the canvas background to be white instead of black (which I seem to recall is the default) since the page background is normally white in the PW backend.

Obviously saving the transparency would be the favourite solution as I know we have one dark admin theme already.

Possible solution here: http://www.php.net/manual/en/function.imagecopyresized.php#104556

Not sure if there would be similar issues with PNGs?

post-1356-132614281903_thumb.gif

Link to comment
Share on other sites

Thanks Pete, I'll take a look at this and should be able to change the BG color. PNGs should be okay, as I think we've fixed something similar with PNGs in the past. GIFs are generally terrible for any kind of resize and I'd recommend avoiding them in any situations where you need to be creating size or crop variations. But I know it's not always a choice. :) Hopefully we can get the transparency working with them.

Link to comment
Share on other sites

No worries - to be honest I didn't even realise it was a GIF until I uploaded it and I'll probably just convert it to a PNG anyway.

I think in my code in the past to get around potential headaches with grainy thumbnailed GIFs I saved them as JPEGs instead to get better compression, but that's not always going to be the desired way to do it.

Link to comment
Share on other sites

  • 8 months later...

I added a few lines to the imageSizer based on code linked to above and tested with regular and transparent GIF and PNG images. Not sure how to submit it. I committed the changes on github and made a pull request.

Hopefully this will be added. I don't think it's reasonable to require users to convert GIF to PNG before uploading.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...