We help IT Professionals succeed at work.
Get Started

image merge error

Sam Cohen
Sam Cohen asked
on
430 Views
Last Modified: 2013-12-12
I have a image located on file (watermark.png) and an image located in the database which renders when i run the url: mydomain.com/show_pic.php?table=homes_images&field=home_img_id&id=11

But when trying to add a watermark to jpeg, I keep getting the following error(s):

*************************************
Warning: imagecreatefromjpeg(show_pic.php?table=homes_images&field=home_img_id&id=11) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in /nfs/c04/h03/mnt/11111/domains/mydomain.com/html/show_pic_sold.php on line 5

Warning: getimagesize(show_pic.php?table=homes_images&field=home_img_id&id=11) [function.getimagesize]: failed to open stream: No such file or directory in /nfs/c04/h03/mnt/11111/domains/mydomain.com/html/show_pic_sold.php on line 6

Warning: imagecopymerge(): supplied argument is not a valid Image resource in /nfs/c04/h03/mnt/11111/domains/mydomain.com/html/show_pic_sold.php on line 9

Warning: imagejpeg(): supplied argument is not a valid Image resource in /nfs/c04/h03/mnt/11111/domains/mydomain.com/html/show_pic_sold.php on line 10

Warning: imagedestroy(): supplied argument is not a valid Image resource in /nfs/c04/h03/mnt/11111/domains/mydomain.com/html/show_pic_sold.php on line 11

***************************************************

My code is below:
<?php
	$watermark = imagecreatefrompng('common/images/watermark.png');
	$watermark_width = imagesx($watermark);
	$watermark_height = imagesy($watermark);
	$image = imagecreatefromjpeg('show_pic.php?table=' . $_GET["table"] . '&field=' . $_GET["field"] . '&id=' . $_GET["id"]);  
	$size = getimagesize('show_pic.php?table=' . $_GET["table"] . '&field=' . $_GET["field"] . '&id=' . $_GET["id"]);
	$dest_x = ($size[0] - $watermark_width)/2;
	$dest_y = ($size[1] - $watermark_height)/2;
	imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);
	imagejpeg($image);
	imagedestroy($image);
	imagedestroy($watermark);
?>

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE