We’re with you. JoomShaper is offering a 20% Discount on all plans due to the impact of COVID-19.

Support Offline : Mon - Fri / 10am - 6pm (GMT +6)

Your Time: Our Time:

Remove black background from thumbs

Featured Lock Resolved
I want to remove the auto-generated back from the thumbs. I have it set to generate png files, but I need a transparent background. I cannot find where in the css or php files the black background is added in. I have taken the auto-generated thumbs into photo shop and removed the background, uploaded the images back into the thumbs folder, but when i refresh the page, the black background is added to the images.

Any ideas?


2 Answers


More than a month ago #Permalink
Figured it out.

Needed to change class.spThumbnail.php
After line:110 //New Image

was: $image_c = ImageCreateTrueColor( $this -> new_width, $this -> new_height );

Added: $black = ImageColorAllocate($image_c, 0, 0, 0);
ImageColorTransparent($image_c, $black);

Removed the black background.


More than a month ago #Permalink
Actually this works better. It keeps the color in the images, where the first solutions seems to knock out reds for some reason.

$image_c = ImageCreateTrueColor( $this -> new_width, $this -> new_height ); /*keep ImageCreateTrueColor to keep colors */
$black = ImageColorAllocate($image_c, 0, 0, 0); /*Detect black background created by imageCreateTrueColor
ImageColorTransparent($image_c, $black); /*might not be necessary; on its own it removes the black but keeps a black stroke around object */
imagealphablending($image_c, false); /* has to be false...if true, the black background returns */
imagesavealpha($image_c, true); /*has to be true, otherwise you get a terrible black stroke around each object */

That should do it. Hope it helps.

There are no replies made for this post yet.
Be one of the first to reply to this post!




Community Users


Don’t miss any updates of our new templates and extensions and all the astonishing offers we bring for you.
We never spam

Joomla! ® name is used under a limited license from Open Source Matters in the United States and other countries. JoomShaper.com is not affiliated with or endorsed by Open Source Matters or the Joomla! Project.

Connect Us