Jump to content

GD Library Watermark code problem


sayndesyn

Recommended Posts

Hi,
  Very appreciative of the help I received on my other problem.  Sadly my code skills are lacking and I am just trying to get this site running because it is down right now.  After a thumbnail page (which the problem was solved in GD-JPEG snafu thread) you link to a page which links to the larger image that is created and placed with a watermark on it via the following code.  I am receiving the following errors.
imagecopyresampled(): supplied argument is not a valid Image resource in <b>/home/10434/domains/viewsfromabove.com/html/vfaPublishing/gallery/Augusta/watermark.php</b> on line <b>12</b><br />
<br />
<b>Warning</b>:  imagejpeg(): supplied argument is not a valid Image resource in <b>/home/10434/domains/viewsfromabove.com/html/vfaPublishing/gallery/Augusta/watermark.php</b> on line <b>14</b><br />
<br />

<b>Warning</b>:  imagedestroy(): supplied argument is not a valid Image resource in <b>/home/10434/domains/viewsfromabove.com/html/vfaPublishing/gallery/Augusta/watermark.php</b> on line <b>15</b><br />

It must be a simple fix because the code worked fine on another server, but like I mentioned my code skills are lacking.

[code]
<?
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($f); 
$size = getimagesize($f); 
$dest_x = $size[0] - $watermark_width - 5; 
$dest_y = $size[1] - $watermark_height - 5; 
//imagecopyresampled($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, $watermark_width, $watermark_height);
imagecopyresampled($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100); 
imagejpeg($image); 
imagedestroy($image); 
imagedestroy($watermark); 
?>
[/code]

In the display page everything is being transmitted right from the mysql table properly, the link to the image looks like.
<img src="watermark.php?f=Augusta Mental Health Institute Augusta Maine_002.JPG" border="0" class="img">
Any help or direction would be appreciated.  The actual links to the area I am testing the changes on is.

http://www.viewsfromabove.com/vfaPublishing/gallery/Augusta/display.php?cat_id=1&page=1

Thanks, Sam
Link to comment
https://forums.phpfreaks.com/topic/34830-gd-library-watermark-code-problem/
Share on other sites

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.