PHPverse 2025

Voting

: seven minus six?
(Example: nine)

The Note You're Voting On

designerkamal at gmail dot com
19 years ago
Skewing images in PHP...
<?php
function Skew($src, $dest, $skew_val)
{
$imgsrc = imagecreatefromgif($src);
$width = imagesx($imgsrc);
$height = imagesy($imgsrc);
$imgdest = imagecreatetruecolor($width, $height+($height*$skew_val));
$trans = imagecolorallocate($imgdest,0,0,0);
$temp=0;
for(
$x=0 ; $x<$width ; $x++)
{
for(
$y=0 ; $y<$height ; $y++)
{
imagecopy($imgdest, $imgsrc, $x, $y+$temp, $x, $y, 1, 1);
imagecolortransparent($imgdest,$trans);

}
$temp+=$skew_val;
}
imagepng($imgdest, $dest);
imagedestroy($imgsrc);
imagedestroy($imgdest);
}
Skew("img.gif", "img2.png","1");
print
"<img src='img.gif'>";
print
"<br><br>";
print
"<img src='img2.png'>";
?>

<< Back to user notes page

To Top