Background Colour - Alpha Channel

Admiror Frames gives the ability to add decorative frame around content, no matter what the content is.
There are a few templates to chose from and you can adjust frames to fit your site design.
Admiror Frames is a nativ Joomla! 2.5, Joomla! 1.7, Joomla! 1.6 and 1.5 Content plugin. One instaler for all Joomla! versions, except 1.0.
Post Reply
Message
Author
User avatar
Bifford
Contributor
Contributor
Posts: 220
Joined: Thu Oct 21, 2010 12:31 am
Location: Essex, UK
Contact:

Background Colour - Alpha Channel

#1 Post by Bifford »

Hi hi!

Now this is an age-old problem with AF, and is the main reason I have never really used it for more than a few occasional places where I could overcome the problem by using a Specific colour as background.

The problem is shown in the screengrab.
AF-Background problems.png
AF-Background problems.png (49.59 KiB) Viewed 31927 times
You will see that the area around the box is white - setting FFFFFF in the plugin settings.

There is no way to make this transparent. And the problem is that 99% of the stuff I do would need that background to be transparent.

So - my question is this: Is it possible to update AF to use the Alpha Layer format of colourisation that has been around in CSS for quite some time. That is: RGBA. It would mean giving the user TWO ways of inputting colours everywhere, and wouldn't just apply to backgrounds.

So you would use a dropdown to select either "RGB Value (Format 00252FF)" or "RGBA Value (Format 155,155,155,0.5 where the last number is between 0.0 and 1.0)"

This means I can have "255,0,0,0.0" and affect a fully transparent background colour.

From http://www.w3schools.com/cssref/css_colors_legal.asp

RGBA Colors
RGBA color values are supported in IE9+, Firefox 3+, Chrome, Safari, and in Opera 10+.

RGBA color values are an extension of RGB color values with an alpha channel - which specifies the opacity of the object.

An RGBA color value is specified with: rgba(red, green, blue, alpha). The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (fully opaque).

Example

p
{
background-color:rgba(255,0,0,0.5);
}

Admiror Gallery 5 - Fundraising Campaign

Karmageddon
Posts: 2
Joined: Thu Feb 06, 2014 12:03 am

Re: Background Colour - Alpha Channel

#2 Post by Karmageddon »

*push*

hello,

that is exactly the topic I was looking for.
I have got a website with bg colour #131315 and {af template=white_border} does not look nice.

Is there a possibility to change the bg of the frames to a custom colour? :)

Thanks for this nice plugin.

Kind regards,
Karma

Karmageddon
Posts: 2
Joined: Thu Feb 06, 2014 12:03 am

Re: Background Colour - Alpha Channel

#3 Post by Karmageddon »

ah how awesome!
in the general plugin parameters you can set the background colour and other usefull presets.

:ugeek:

thank you :)

cyb0rg
Posts: 1
Joined: Thu Feb 18, 2016 3:21 am

Re: Background Colour - Alpha Channel

#4 Post by cyb0rg »

Old topic but I have a solution for when the background color is set to FFFFFF.

In /scripts/AF_gd_stream.php

After

Code: Select all

@$dst_img = imagecreatetruecolor($dst_w, $dst_h);
Add this:

Code: Select all

// ----  New Code -----
if($bgcolor == "FFFFFF")
{
	imagealphablending($dst_img , false);
	imagesavealpha($dst_img, true);
}
else
{
	$AF_bgcolor_RGB = array(
    	base_convert(substr($bgcolor, 0, 2), 16, 10),
    	base_convert(substr($bgcolor, 2, 2), 16, 10),
   	 base_convert(substr($bgcolor, 4, 2), 16, 10)
	);

	$AF_BGCOLOR = imagecolorallocate($dst_img, $AF_bgcolor_RGB[0], $AF_bgcolor_RGB[1], $AF_bgcolor_RGB[2]);

	imagefill($dst_img, 0, 0, $AF_BGCOLOR);
}
@imagecopyresampled($dst_img, $src_img, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);


// saving
if($bgcolor == "FFFFFF")
{
imagealphablending($dst_img , false);
imagesavealpha($dst_img , true);
}
imagepng ( $dst_img, NULL );
// ---- End New Code ------
And remove everything else up until this line:

Code: Select all

@imagedestroy($dst_img);
So it should look like this:

Code: Select all

@$dst_img = imagecreatetruecolor($dst_w, $dst_h);

// ----  New Code -----
if($bgcolor == "FFFFFF")
{
	imagealphablending($dst_img , false);
	imagesavealpha($dst_img, true);
}
else
{
	$AF_bgcolor_RGB = array(
    	base_convert(substr($bgcolor, 0, 2), 16, 10),
    	base_convert(substr($bgcolor, 2, 2), 16, 10),
   	 base_convert(substr($bgcolor, 4, 2), 16, 10)
	);

	$AF_BGCOLOR = imagecolorallocate($dst_img, $AF_bgcolor_RGB[0], $AF_bgcolor_RGB[1], $AF_bgcolor_RGB[2]);

	imagefill($dst_img, 0, 0, $AF_BGCOLOR);
}
@imagecopyresampled($dst_img, $src_img, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);


// saving
if($bgcolor == "FFFFFF")
{
imagealphablending($dst_img , false);
imagesavealpha($dst_img , true);
}
imagepng ( $dst_img, NULL );
// ---- End New Code ------
@imagedestroy($dst_img);
You'll want your C.png in your template to be transparent as well unless you want a a colored background. Don't forget to set background color to FFFFFF in plugin options.

Post Reply