I've adapted the following code to use to watermark images on my website:


header('content-type: image/jpeg'); 

$wmarkloc =  "/home/site/public_html/tag.png";
$imageloc = "/home/site/public_html/mainpic.jpg";

$watermark = imagecreatefrompng($wmarkloc);  
  $red = imagecolorallocate($watermark, 255, 0, 0);
  imagecolortransparent($watermark, $red);

$watermark_width = imagesx($watermark);  
$watermark_height = imagesy($watermark);  
$image = imagecreatetruecolor($watermark_width, $watermark_height);  
$image = imagecreatefromjpeg($imageloc);  
$size = getimagesize($imageloc);  
imagecopymerge($image, $watermark, 0, 0, 0, 0, $watermark_width, $watermark_height, 100);  


The problem is, I want to copy the image to a location on my server instead of display the image. I tried using copy($image,'/home/site/public_html/newpicture.jpg') but that did nothing. Also, like I said, I don't want to see the image, I just want a "success message" to be output so that I can make multiple images at once.