
Den ljusa kanten syns i mitten av bilden
(Bilden är här i dubbel storlek)
Kod:
<?php
header ("Content-type: image/png");
$imageurl = "upload/".$_GET["arg"];
//######################################
list($width, $height) = getimagesize($imageurl);
$new_width = 340;
$new_height = 480;
// Resample
$photoImage = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($imageurl);
imagecopyresampled($photoImage, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
ImageAlphaBlending($photoImage, true);
//######################################
$hackImage = ImageCreateFromPNG('hack.png');
imagesavealpha($hackImage,true);
$editImage = ImageCreateFromPNG('overlay.png');
imagesavealpha($editImage,true);
$logoW = ImageSX($photoImage);
$logoH = ImageSY($photoImage);
$coverW = ImageSX($editImage);
$coverH = ImageSY($editImage);
ImageCopy($hackImage, $photoImage, 3, 16, 0, 0, $logoW, $logoH);
ImageCopy($hackImage, $editImage, 0, 0, 0, 0, $coverW, $coverH);
imagepng($hackImage); // output to browser
ImageDestroy($photoImage);
ImageDestroy($hackImage);
ImageDestroy($editImage);
unlink($imageurl);
?>
Bilden byggs alltså upp av en "standardbild", ovanpå denna läggs en bild till, och sedan en "ram" bestående av en PNG.