Note that there are some explanatory texts on larger screens.

plurals
  1. POTranslucent Image Reflection in PHP GD
    text
    copied!<p>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. <br /> The following guide shows how to do it with an opaque color : <a href="http://www.talkphp.com/advanced-php-programming/1714-image-reflections-php.html" rel="nofollow noreferrer">TalkPHP Forums Link</a> <br /> <br /> In that forum, Rendair describes a way to overlay a dynamically drawn gradient using a color, with the following PHP code:</p> <pre><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 &lt; $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; } } </code></pre> <p>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. <br /> Any PHP folks out there who have any genius ideas?<br /> <strong>Update:</strong> this question has earned me the tumbleweed badge. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload