Jump to content

[SOLVED] Need help capturing an image produced on the fly


Recommended Posts

I have a script running on Server1 that creates an image, saves it, then loads it and sends it to the browser, then deletes the image from disk.....Server2 needs to have access to that image, and have the ability to manipulate the image.  Server1's address would look something similar to http://128.23.23.23/file.php?name=picname

 

Now what I need to do is access that image from Server2, and save it as a jpg.

 

Server1 (image sender) is running this script:

$pic=$_GET['pic'];

//Some code to create the image goes here....It works fine.....saves the image fine...

header("Content-Type: image/jpeg");
$theImage = imagecreatefromjpeg('C:/wamp/www/'.$pic.'.jpg');
imagejpeg($theImage);
unlink('C:/wamp/www/'.$pic.'.jpg');

 

Server2 (image requester) is running this script:

$url='sitename/file.php?pic=nameofpic';

$dst_img=imagecreatetruecolor(350, 270);
$src_img=imagecreatefromjpeg($url);
imagecopy($dst_img, $src_img,0,0,0,0,350,270);
imagejpeg($dst_img, './images/'.$_POST['url'].'.jpg', 100);
imagedestroy($dst_img);

 

When I try to run the Server2 script I get an error:

Warning: imagecreatefromjpeg(sitename/file.php?pic=picname) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in /home/crystal/public_html/thumb.html on line 8

 

 

 

Link to comment
Share on other sites

I should also add that if you try to get the image using the <img> tag, the image doesn't show up.....But if you run the image producing script directly from the browser, the image appears fine...

 

Originally I was getting results from http://64.39.14.230/dh-asp/image.asp?url=www.phpfreaks.com&w=800&h=600 and it worked fine....I could use that url in an image tag and the image would appear....But I have since created my own image capture and placed it on my home computer....So if you wanted to get a screen capture for phpfreaks, you would follow this link http://75.70.58.210/?site=www.phpfreaks.com, or you could change the website to any website and the script will produce a medium sized image of the website.....But for some reason, I am unable to place that URL into the img tag and have that image appear....

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.