Cod: Selectaţi tot
<?php
$imagesource = $_GET['path'];
$watermarkPath = $_GET['watermark'];
$filetype = substr($imagesource,strlen($imagesource)-4,4);
$filetype = strtolower($filetype);
$watermarkType = substr($watermarkPath,strlen($watermarkPath)-4,4);
$watermarkType = strtolower($watermarkType);
if($filetype == ".gif")
$image = @imagecreatefromgif($imagesource);
else
if($filetype == ".jpg" || $filetype == "jpeg")
$image = @imagecreatefromjpeg($imagesource);
else
if($filetype == ".png")
$image = @imagecreatefrompng($imagesource);
else
die();
if(!$image)
die();
if($watermarkType == ".gif")
$watermark = @imagecreatefromgif($watermarkPath);
else
if($watermarkType == ".png")
$watermark = @imagecreatefrompng($watermarkPath);
else
die();
if(!$watermark)
die();
$imagewidth = imagesx($image);
$imageheight = imagesy($image);
$watermarkwidth = imagesx($watermark);
$watermarkheight = imagesy($watermark);
$startwidth = (($imagewidth - $watermarkwidth)/2);
$startheight = (($imageheight - $watermarkheight)/2);
imagecopy($image, $watermark, $startwidth, $startheight, 0, 0, $watermarkwidth, $watermarkheight);
imagejpeg($image);
imagedestroy($image);
imagedestroy($watermark);
?>
<img src="watermark.php?path=imagepath">
cu text nu am reusit
am folosit ceva de genul ..dar nu functioneaza
imaginile sunt aleatorii ,nu prea pot sa explic..
nu am adresa completa
le preiau cam in genul /upload/imagine.jpg iar apoi ca sa fie afisate adaug hostul
http:// site.com/upload/imagine.jpg, nu stochez nimic pe server