Alright, I've been hacking around with GD Image for a couple of months, and a task that I wanted to accomplish with it was to create a script that takes an existing image, and then creates a reflection that fades out to translucent beneath it.
The following guide shows how to do it with an opaque color : TalkPHP Forums Link
In that forum, Rendair describes a way to overlay a dynamically drawn gradient using a color, with the following PHP code:
// Next we draw a GD line into our gradient_line
imageline ($gradient_line, 0, 0, $imgName_w, 0, $gdGradientColor);
$i = 0;
$transparency = 30; //from 0 - 100
while ($i < $gradientHeight) //create line by line changing as we go
{
imagecopymerge ($background, $gradient_line, 0,$gradient_y_startpoint, 0, 0, $imgName_w, 1, $transparency);
++$i;
++$gradient_y_startpoint;
if ($transparency == 100) {
$transparency = 100;
}
else
{
// this will determing the height of the
//reflection. The higher the number, the smaller the reflection.
//1 being the lowest(highest reflection)
$transparency = $transparency + 1;
}
}
What I'm attempting to accomplish is an effect where we similarly fade each line to one shade more translucent using the alpha feature, but it seems that I have a hard time applying it one line at a time. So far I can only make a tiny slice of the image (one line large) and then overlay it with translucency, I can't seem to fade each line a bit more. So my intended result should be the initial image, then a reflected copy that fades to 100% alpha transparent, but I can't seem to accomplish this.
Any PHP folks out there who have any genius ideas?
Update: this question has earned me the tumbleweed badge.