webbnino Posted July 21, 2009 Share Posted July 21, 2009 Hi friends, can any one please help me on this... I have a generator.php on a server(A), which gets an image from that server with an id given to the page. I have a data.php in another server(B) and I want to save the image on the server A in B by calling the generator.php in the data.php, by using some method like file_get_contents('serverA/generator.php?id-245'), This method works perfectly if we are trying to get some text information instead of an image. Can anyone please advise on how to do this with an image , or how to send and save images using http.. Thanks in advance Link to comment https://forums.phpfreaks.com/topic/166867-solved-getting-images-from-another-server-on-the-fly/ Share on other sites More sharing options...
Bendude14 Posted July 22, 2009 Share Posted July 22, 2009 can you not just link directly to the other image, if you had the image named with the correct id you could just do this, <img src="http://serverA.com/images/245.jpg" alt="" /> Ben Link to comment https://forums.phpfreaks.com/topic/166867-solved-getting-images-from-another-server-on-the-fly/#findComment-879978 Share on other sites More sharing options...
webbnino Posted July 22, 2009 Author Share Posted July 22, 2009 Thanks for the reply Ben. I have to save the image to my server as well, also the path of the image in the server is generated from the id provided. In some cases cropping of the image has to be done also. when I used, $fil = file_get_contents('serverA/generator.php?id-245'), file_put_contents('local-path-to-save/name.jpg',$fil); it worked. Link to comment https://forums.phpfreaks.com/topic/166867-solved-getting-images-from-another-server-on-the-fly/#findComment-880762 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.