I have this code to add watermark. I tried to run it on my iis7 server but the only thing I get on the screen is the full path of the php script why is that?
<?php header('content-type: image/jpeg'); $watermark = imagecreatefrompng('watermark.png'); $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); $image = imagecreatetruecolor($watermark_width, $watermark_height); $image = imagecreatefromjpeg($_GET['wallpapers/Black_Dog.jpg']); $size = getimagesize($_GET['wallpapers/Black_Dog.jpg']); $dest_x = $size[0] - $watermark_width - 5; $dest_y = $size[1] - $watermark_height - 5; imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100); imagejpeg($image); imagedestroy($image); imagedestroy($watermark); ?> Code (markup): the watermark picture and the wallpapers folder located in the same place where the script is.
From a quick look what is the $_GET in the imagecrate and getimagesize in there for? You would use get for a variable in the URL since you already have the value of the variable (wallpapers/Black_Dog.jpg) you can place that directly in the tags try: <?php header('content-type: image/jpeg'); $watermark = imagecreatefrompng('watermark.png'); $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); $image = imagecreatetruecolor($watermark_width, $watermark_height); $image = imagecreatefromjpeg('wallpapers/Black_Dog.jpg'); $size = getimagesize('wallpapers/Black_Dog.jpg'); $dest_x = $size[0] - $watermark_width - 5; $dest_y = $size[1] - $watermark_height - 5; imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100); imagejpeg($image); imagedestroy($image); imagedestroy($watermark); ?> PHP:
On a linux box, /var/log/httpd usually holds the error_log, from which you can view errors generated by PHP. On a localhost WAMP/EasyPHP/etc, you can find a similar file depending on your setup. It's extremely useful.
I found the logs but when I try to open them it says that it already in use. How can I see the logs? maybe with the iis manager?