jumpenjuhosaphat Posted May 18, 2007 Share Posted May 18, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/51974-solved-need-help-capturing-an-image-produced-on-the-fly/ Share on other sites More sharing options...
jumpenjuhosaphat Posted May 18, 2007 Author Share Posted May 18, 2007 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.... Quote Link to comment https://forums.phpfreaks.com/topic/51974-solved-need-help-capturing-an-image-produced-on-the-fly/#findComment-256207 Share on other sites More sharing options...
jumpenjuhosaphat Posted May 18, 2007 Author Share Posted May 18, 2007 It always seems to be the most obvious answer to the problem.....I forgot to place http:// in front of the IP address, and that's why it wasn't loading...... Quote Link to comment https://forums.phpfreaks.com/topic/51974-solved-need-help-capturing-an-image-produced-on-the-fly/#findComment-256261 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.