Joshua4550 Posted July 31, 2010 Share Posted July 31, 2010 Hey. I'm just wondering what would be the most logical or most efficient way to save an image resource that has been constructed on say the www. to a subdirectory or on another webserver? For eg The script on www.example.com constructs an image using the GD library from image1.png and image2.png. It has now got the final image resource for what's been constructed. I now want to save this image onto images.example.com How would you suggest? Quote Link to comment https://forums.phpfreaks.com/topic/209458-saving-image-resource-onto-subdirectory/ Share on other sites More sharing options...
Spring Posted July 31, 2010 Share Posted July 31, 2010 This thread is relevant to my interests. Quote Link to comment https://forums.phpfreaks.com/topic/209458-saving-image-resource-onto-subdirectory/#findComment-1093657 Share on other sites More sharing options...
sspoke Posted July 31, 2010 Share Posted July 31, 2010 try something like this $url=file_get_contents("http://example.com/makeimage.php"); $fp = fopen("images/imgSave.png", 'wb'); fwrite($fp, $url); fclose($fp); Quote Link to comment https://forums.phpfreaks.com/topic/209458-saving-image-resource-onto-subdirectory/#findComment-1093660 Share on other sites More sharing options...
Joshua4550 Posted July 31, 2010 Author Share Posted July 31, 2010 Depends what you're putting in makeimage.php and which subdomain (www or images) each script goes on. Explain (BTW: I meant subdomain, not subdirectory -.-) Quote Link to comment https://forums.phpfreaks.com/topic/209458-saving-image-resource-onto-subdirectory/#findComment-1093662 Share on other sites More sharing options...
sspoke Posted July 31, 2010 Share Posted July 31, 2010 then all you can do is inside that subdomain add a upload script which works of some $_REQUEST field that holds the data of bytes? i'm guessing.. then call the upload script using php with proper parameters but yah i guess someone else who understands this more will help you out. Haha yah it's similar to my needs too only i need a txt file not a image.. strange how phpfreaks forum works.. every week i ask a question there is atleast a few similar to my needs questions Quote Link to comment https://forums.phpfreaks.com/topic/209458-saving-image-resource-onto-subdirectory/#findComment-1093669 Share on other sites More sharing options...
Joshua4550 Posted July 31, 2010 Author Share Posted July 31, 2010 I'm guessing you don't understand that i'm not uploading. I'm using the GD library to create an image resource stored in a variable from two existing images. But yeah.. I need to make it construct on the www but then save the image to a subdomain such as images.example.com (saving using the imagepng() function btw) Guessing I should pass the image resource through to another script located on the subdomain, just not sure how I would go about passing it through. Thanks in advance to anyone who helps Quote Link to comment https://forums.phpfreaks.com/topic/209458-saving-image-resource-onto-subdirectory/#findComment-1093670 Share on other sites More sharing options...
Spring Posted July 31, 2010 Share Posted July 31, 2010 Can someone help? Quote Link to comment https://forums.phpfreaks.com/topic/209458-saving-image-resource-onto-subdirectory/#findComment-1093714 Share on other sites More sharing options...
Alex Posted July 31, 2010 Share Posted July 31, 2010 Even though it's a subdomain it has a file system path, and that's what you need to pass to imagepng. Quote Link to comment https://forums.phpfreaks.com/topic/209458-saving-image-resource-onto-subdirectory/#findComment-1093717 Share on other sites More sharing options...
kickstart Posted August 4, 2010 Share Posted August 4, 2010 Hi Depends where images.example.com is pointing. Also possible that you could store the images somewhere outside of the web directory and then use a php script to serve them. This way you can control access to the images (ie, if the images are of sensitive graphs of info you probably only want certain users to see them). All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/209458-saving-image-resource-onto-subdirectory/#findComment-1095349 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.