Unlike God has probably wanted it to be, I’m very determined to learn MySQL and GD libraries as fast and extensively as possible. I’ve been trying to get this sort of an Apple effect, that I would have a source image and the mission would be have it reflect from a glass surface (vrt. http://images.apple.com/ipodnano/images/indexgallery20060912.jpg).
I have two source images: the picture of the object (120x168 pixels, 11111_small.jpg) and the fader (120x84 pixels, fade.png), which is basically a 50% alpha’d white to full white linear gradient. Currently, I have managed to make a new Content/png PHP-file, it imports the source images and manages to even flip the first one and place it correctly. There are just two things that I can’t get to work.[LIST=1]
[]The colors are quite… flat.
[]The alpha options in the fader do not work - it’s full white.[/LIST]The code as follows:
<?php
header("Content-type: image/png");
function flipImage($pic) {
$w = imagesx($pic);
$h = imagesy($pic);
$flipped = imagecreatetruecolor($w, $h);
for ($y=0; $y<$h; $y++) {
imagecopy($flipped, $pic, 0, $y, 0, $h - $y - 1, $w, 1);
}
return $flipped;
}
$ppic = imagecreate(120,252);
$w = imagesx($ppic);
$h = imagesy($ppic);
if(file_exists("img/products/".$_GET["id"]."_small.jpg")){
$imgname = "img/products/".$_GET["id"]."_small.jpg";
$im1 = @imagecreatefromjpeg($imgname);
imagecopy($ppic, $im1, 0, 0, 0, 0, $w, $h);
$fpic = flipImage($im1);
imagecopy($ppic, $fpic, 0, 168, 0, 0, $w, $h);
$fader = "img/fade.png";
$im2 = @imagecreatefrompng($fader);
imagecopy($ppic, $im2, 0, 168, 0, 0, $w, $h);
} else {
$imgname = "img/nopic.png";
$im1 = @imagecreatefrompng($imgname);
imagecopy($ppic, $im1, 0, 0, 0, 0, $w, $h);
}
imagepng($ppic);
imagedestroy($ppic);
?>
And its result here: http://denvish.net/ulf/180307/44320_weird.png