Gafaddict Posted October 10, 2007 Share Posted October 10, 2007 Hi guys, At the moment I'm writing a script which deals with the possibility of analyzing a file that is not on my server -- rather, it is located on another server and a completely different domain. Say the image is http://www.example.com/logo.jpg. The script needs to find out the dimensions of logo.jpg when a user inputs that string into a textbox. I know how to get the dimensions of an image on the server, but how would I get the dimensions of an external image? Is it even possible? If that is not possible, how would one go about copying that external image from the URL to their own server? I've seen this done before in phpBB before but they don't seem to have any documentation about it. Thanks in advance, Quote Link to comment https://forums.phpfreaks.com/topic/72546-solved-working-with-external-images/ Share on other sites More sharing options...
MadTechie Posted October 10, 2007 Share Posted October 10, 2007 same way as any other image... <?php $path= "http://www.example.com/logo.jpg"; $size = getimagesize($path); //or even $path = urlencode($path); $size = getimagesize($path); ?> EDIT: also you can use copy to copy the image or imagecreatefromjpeg, providing fopen wrappers have been enabled Quote Link to comment https://forums.phpfreaks.com/topic/72546-solved-working-with-external-images/#findComment-365851 Share on other sites More sharing options...
Gafaddict Posted October 11, 2007 Author Share Posted October 11, 2007 MadTechie, The first option worked fine. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/72546-solved-working-with-external-images/#findComment-367484 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.