View file waplend/img/image.php

File size: 1.19Kb
<?php 
$watermark = "water.png"; 

$im = imagecreatefrompng($watermark); 

$image = $_GET['image']; 

$types = array(1 => "gif", 2 => "jpeg", 3 => "png"); 
if ($image_info = @getimagesize($image)) 
{ 
  $image_create_handle = "imagecreatefrom".$types[$image_info[2]]; 
  if (!$im2 = @$image_create_handle($image)) 
  { 
    die("Error opening $image!"); 
  } 

  imagecopy($im2, $im, (imagesx($im2)/100)-(imagesx($im)/100), (imagesy($im2)/100)-(imagesy($im)/100), 0, 0, imagesx($im), imagesy($im)); 

  if($_GET[repeat]) 
  { 
    $waterless = imagesx($im2) - imagesx($im); 
    $rest = ceil($waterless/imagesx($im)/1); 

    for($n=1; $n<=$rest; $n++) 
    { 
      imagecopy($im2, $im, ((imagesx($im2)/100)-(imagesx($im)/100))-(imagesx($im)*$n), (imagesy($im2)/100)-(imagesy($im)/100), 0, 0, imagesx($im), imagesy($im)); 
      imagecopy($im2, $im, ((imagesx($im2)/100)-(imagesx($im)/100))+(imagesx($im)*$n), (imagesy($im2)/100)-(imagesy($im)/100), 0, 0, imagesx($im), imagesy($im)); 
    } 
  } 

  header("Content-Type: image/jpeg"); 
  imagejpeg($im2, $destination, 90); 
  imagedestroy($im); 
  imagedestroy($im2); 
} 
else 
{ 
  die("Error opening $image!"); 
} 
?>