[Edit] PHP GD Image Reflections
how to create an image reflection in PHP using GD $im = 'path/to/image.jpg'; // The input image $size = getimagesize($im); $rH = 150; // Reflection height $tr = 30; // Starting transparency $div = 1; // Size of the divider line $w = $size[0]; $h = $size[1]; $im = imagecreatefromjpeg($im); $li = imagecreatetruecolor($w, 1); $bgc = imagecolorallocate($li, 255, 255, 255); // Background color imagefilledrectangle($li, 0, 0, $w, 1, $bgc); $bg = imagecreatetruecolor($w, $rH); $wh = imagecolorallocate($im,255,255,255); $im = imagerotate($im, -180, $wh); imagecopyresampled($bg, $im, 0, 0, 0, 0, $w, $h, $w, $h); $im = $bg; $bg = imagecreatetruecolor($w, $rH); for ($x = 0; $x < $w; $x++) { imagecopy($bg, $im, $x, 0, $w-$x, 0, 1, $rH); } $im = $bg; $in = 100/$rH; for($i=0; $i<=$rH; $i++){ if($tr>100) $tr = 100; imagecopymerge($im, $li, 0, $i, 0, 0, $w, 1, $tr); $tr+=$in; } imagecopymerge($im, $li, 0, 0, 0, 0, $w, $div, 100); // Divider header('content-type: image/jpeg'); imagejpeg($im, '', 100); imagedestroy($im); imagedestroy($li); |
This Page is Under Construction! - If You Want To Help Please Send your CV - Advanced Web Core (BETA)
© Advanced Web Core. All rights reserved