Dynamic image transparency
| From: | Jacob Kruger | Date: | Fri, 09 Aug 2013 11:13:33 +0000 |
| Subject: | Dynamic image transparency | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-31103@lists.php.net to get a copy of this message | ||
Ok, along the lines of image fading, think might have found code, etc. to handle applying form of
dynamic overall transparency effect to an image, and if so, could then cut out expanding pieces of
an original image, and apply higher levels of transparency to the bigger instances and then do
something like overlay them on each other using imagecopy() or imagecopyresize().
Either way, if you want to have a look at this page, you can tell me if it's operating/working
at all - for now just trying to make sure dynamically applied transparency is working at all:
http://www.blindza.co.za/transparency/index.php
And, the actual code to implement the transparency is the following - from trans.php:
<?php session_start(); ?>
<?php
$iTransValue = 127;
//if form on index.php was submitted, I set session val
if (isset($_SESSION["iTransValue"])) {
$iTransValue = intval($_SESSION["iTransValue"]);
}
$img = imagecreatefrompng("./images/razor1.png");
imagealphablending($img, false);
imagesavealpha($img , true);
$trans_colour = imagecolorallocatealpha($img , 0, 0, 0, $iTransValue);
imagefill($img , 0, 0, $trans_colour);
header('Content-Type: image/png');
header("Content-Disposition: attachment; filename=\"razor1.png\"");
imagepng($img);
imagedestroy($img);
?>
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'