wet-floor-buggy
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
function artwork ($pic='pic.jpg', $width=300) {
header("Content-type: image/jpeg");
$gImg = imagecreatefromjpeg($pic);
$gTempImg = imagecreatetruecolor(500, 500);
$gNewImg = imagecreatetruecolor(500, 500);
$bg = imagecolorallocate($gNewImg, 0, 0, 0);
list($iWidth, $iHeight) = getimagesize($pic);
$iRatio = $width / $iWidth;
$height = $iHeight * $iRatio;
imagecopyresampled($gTempImg, $gImg, 0, 0, 0, 0, $width, $height, $iWidth, $iHeight);
$iYTotal = 0;
for ($y = 0; $y <= $height; $y++) {
$ratio = 0;
$iYTotal++;
for ($x = 0; $x <= $width; $x++) {
$color = imagecolorat($gTempImg, $x, $y);
$r = ($color >> 16) & 0xFF;
$g = ($color >> 8) & 0xFF;
$b = $color & 0xFF;
$clr = imagecolorallocate($gNewImg, $r, $g, $b);
imagesetpixel($gNewImg, ($x + 50), ($y + $height - ceil($height - $ratio) + 1), $clr);
$ratio += 0.05;
}
}
$i = 1;
for ($y = 0; $y <= $height; $y++) {
if ($y >= ($height / 2) && $y <= ($height - 1)) {
if ($height > 80) $iAHeight = 80;
$ratio = 0;
$alpha = 80 + ($iAHeight / 2) - $i * ($iAHeight / 80) + 20;
$i++;
for ($x = 0; $x <= $width; $x++) {
$color = imagecolorat($gTempImg, $x, $y);
$r = ($color >> 16) & 0xFF;
$g = ($color >> 8) & 0xFF;
$b = $color & 0xFF;
$clr = imagecolorallocatealpha($gNewImg, $r, $g, $b, $alpha);
imagesetpixel($gNewImg, (50 + $x), ($height - $y + ceil($height + $ratio) - 3), $clr);
$ratio += 0.05;
}
}
}
imagedestroy($gTempImg);
imagejpeg($gNewImg, NULL, 100);
imagedestroy($gNewImg);
}
if (isset($_GET['pic']) && !empty($_GET['pic'])) {
artwork($_GET['pic']);
} else {
artwork('pic.jpg', $_GET['w']);
}
?>
function artwork ($pic='pic.jpg', $width=300) {
header("Content-type: image/jpeg");
$gImg = imagecreatefromjpeg($pic);
$gTempImg = imagecreatetruecolor(500, 500);
$gNewImg = imagecreatetruecolor(500, 500);
$bg = imagecolorallocate($gNewImg, 0, 0, 0);
list($iWidth, $iHeight) = getimagesize($pic);
$iRatio = $width / $iWidth;
$height = $iHeight * $iRatio;
imagecopyresampled($gTempImg, $gImg, 0, 0, 0, 0, $width, $height, $iWidth, $iHeight);
$iYTotal = 0;
for ($y = 0; $y <= $height; $y++) {
$ratio = 0;
$iYTotal++;
for ($x = 0; $x <= $width; $x++) {
$color = imagecolorat($gTempImg, $x, $y);
$r = ($color >> 16) & 0xFF;
$g = ($color >> 8) & 0xFF;
$b = $color & 0xFF;
$clr = imagecolorallocate($gNewImg, $r, $g, $b);
imagesetpixel($gNewImg, ($x + 50), ($y + $height - ceil($height - $ratio) + 1), $clr);
$ratio += 0.05;
}
}
$i = 1;
for ($y = 0; $y <= $height; $y++) {
if ($y >= ($height / 2) && $y <= ($height - 1)) {
if ($height > 80) $iAHeight = 80;
$ratio = 0;
$alpha = 80 + ($iAHeight / 2) - $i * ($iAHeight / 80) + 20;
$i++;
for ($x = 0; $x <= $width; $x++) {
$color = imagecolorat($gTempImg, $x, $y);
$r = ($color >> 16) & 0xFF;
$g = ($color >> 8) & 0xFF;
$b = $color & 0xFF;
$clr = imagecolorallocatealpha($gNewImg, $r, $g, $b, $alpha);
imagesetpixel($gNewImg, (50 + $x), ($height - $y + ceil($height + $ratio) - 3), $clr);
$ratio += 0.05;
}
}
}
imagedestroy($gTempImg);
imagejpeg($gNewImg, NULL, 100);
imagedestroy($gNewImg);
}
if (isset($_GET['pic']) && !empty($_GET['pic'])) {
artwork($_GET['pic']);
} else {
artwork('pic.jpg', $_GET['w']);
}
?>