Jump to content

watermark pict destination problem


web_master

Recommended Posts

Hi, Ive got a script for a take a watermark on a picture

 

in this case work fine

 

<?php
header('content-type: image/jpeg');
$watermark = imagecreatefrompng('zoom.png');
$watermark_width = imagesx($watermark);
$watermark_height = imagesy($watermark);
$image = imagecreatetruecolor($watermark_width, $watermark_height);

$image = imagecreatefromjpeg('1_photo_thumb.jpg');
imagealphablending($image, true);
$size = getimagesize('1_photo_thumb.jpg');
$dest_x = $size[0] - $watermark_width - 5;
$dest_y = $size[1] - $watermark_height - 5;
imagecopy($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height);

imagejpeg($image);
imagedestroy($image);
imagedestroy($watermark);

print $image;
?>

 

but in this case don't work (differece is only a  destination of the pictures)

 

<?php
header('content-type: image/jpeg');
$watermark = imagecreatefrompng('media/pict/zoom.png');
$watermark_width = imagesx($watermark);
$watermark_height = imagesy($watermark);
$image = imagecreatetruecolor($watermark_width, $watermark_height);

$image = imagecreatefromjpeg('media/pict/1_photo_thumb.jpg');
imagealphablending($image, true);
$size = getimagesize('media/pict/1_photo_thumb.jpg');
$dest_x = $size[0] - $watermark_width - 5;
$dest_y = $size[1] - $watermark_height - 5;
imagecopy($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height);

imagejpeg($image);
imagedestroy($image);
imagedestroy($watermark);

print $image;
?>

 

What can I do, to work this script when the pictures is in the other directory?

 

thnx

Link to comment
https://forums.phpfreaks.com/topic/77126-watermark-pict-destination-problem/
Share on other sites

PEOPLE A NEED HELP / its allmost working. Please look the site, where is this watermarked picture, than look it in a source code where is a picture and You will see the table and the other things - but why cant see it in the browser, why can see only the picture?

 

 

http://www.medovarski.com/product.php

 

 

:(

My guess is that your directory of 'media/pict/' is incorrect.

 

Check the path and see what happens?

<?php 
$filename = "media/pict/zoom.png"; 
if (file_exists($filename)) { 
echo "The file $filename exists"; 
} else { 
echo"The file $filename does not exist"; 
} 
?> 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.