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?

Thanks!

2 Answers

Jon

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.

Jon

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!

Leaderboard (30 days)

Paul Frankowski

Paul Frankowski

Total Accepted Answers: 119
Sifat

Sifat

Total Accepted Answers: 63
Toufiq

Toufiq

Total Accepted Answers: 60
Mehtaz Afsana

Mehtaz Afsana

Total Accepted Answers: 13
Rashida Rahman

Rashida Rahman

Total Accepted Answers: 11

118

Templates

302819

Community Users

Newsletter

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