Skip to content
Addon for Cockpit CMS - replace SimpleImage library to prevent black backgrounds (transp. gif/png, non-bundled GD)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Helper
README.md
bootstrap.php

README.md

SimpleImageFixBlackBackgrounds

Addon for Cockpit CMS, that replaces an image library with a modified version to prevent black backgrounds of transparent images with non-bundled PHP/GD versions.

This is a modified version of the SimpleImage library by Raffael Jesche.

On some hosts, transparent png and gif files lose their transparency and the background turns black.

After multiple days of digging through the code, reading about GD and doing a lot of tests, I'm pretty sure, that the problem comes from differences between bundled and non-bundled PHP/GD versions.

I fixed the problem with black backgrounds after cropping/resizing images, but this library doesn't work with filters anymore.

This library is written to replace the original library in Cockpit CMS, that displays black backgrounds for thumbnails on some hosts. It will only get active, if (GD_BUNDLED === 0).

I wasn't able to test it on different hosts with non-bundled GD. My test scenario was on an Uberspace 7 (CentOS 7, PHP 7+), which uses a non-bundled GD version.

If you also have problems with black backgounds, than my fix might work for you.

Source, Discussion

Installation

Copy this repository into /addons and name it SimpleImageFixBlackBackgrounds or

cd path/to/cockpit
git clone https://github.com/raffaelj/cockpit_SimpleImageFixBlackBackgrounds.git addons/SimpleImageFixBlackBackgrounds
You can’t perform that action at this time.