-Karl- Posted June 1, 2010 Share Posted June 1, 2010 Hey, Just wondering what the most effective method would be, to transfer/copy images from one website to another. I've tried the copy() function, but it's incredibly slow. Any input is appreciated. Link to comment https://forums.phpfreaks.com/topic/203483-copy-images/ Share on other sites More sharing options...
shadiadiph Posted June 1, 2010 Share Posted June 1, 2010 save the images in a folder and file names in a database on the main website and then open a database connection from the second website calling the info from the first website in the database connection on the second website don't use localhost use the first websites ip address also on the first website if need be in your cpanel allow remote sql access from the ip address of the second one Link to comment https://forums.phpfreaks.com/topic/203483-copy-images/#findComment-1065987 Share on other sites More sharing options...
-Karl- Posted June 1, 2010 Author Share Posted June 1, 2010 I do not own the first website. Link to comment https://forums.phpfreaks.com/topic/203483-copy-images/#findComment-1065989 Share on other sites More sharing options...
shadiadiph Posted June 1, 2010 Share Posted June 1, 2010 so are you talking about the basic layout then logo menu images then? Link to comment https://forums.phpfreaks.com/topic/203483-copy-images/#findComment-1065991 Share on other sites More sharing options...
-Karl- Posted June 1, 2010 Author Share Posted June 1, 2010 Huh? I'm talking about grabbing an image from a different server, then saving it locally. I have a way that works, but it takes around 30 seconds per image. These images are small, around 700 bytes on average. Link to comment https://forums.phpfreaks.com/topic/203483-copy-images/#findComment-1065995 Share on other sites More sharing options...
shadiadiph Posted June 1, 2010 Share Posted June 1, 2010 30 seconds seems about right to copy and transfer it will be slow also might run into problems if the other website has a monthly transfer limit when its reached you won't be able to do anything. Link to comment https://forums.phpfreaks.com/topic/203483-copy-images/#findComment-1065998 Share on other sites More sharing options...
-Karl- Posted June 1, 2010 Author Share Posted June 1, 2010 30 seconds, for a 700 byte file? I highly doubt that. I've created a new method, however, it's not saving it correctly for some reason. $id = image; $ch = curl_init ("http://www.thatsite.com" . $id); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); $rawdata = curl_exec ($ch); curl_close ($ch); $fp = fopen("images/image.gif",'w'); fwrite($fp, $rawdata); fclose($fp); When trying to load it I get The image “***/images/image.gif” cannot be displayed, because it contains errors. That's using firefox Link to comment https://forums.phpfreaks.com/topic/203483-copy-images/#findComment-1066003 Share on other sites More sharing options...
-Karl- Posted June 1, 2010 Author Share Posted June 1, 2010 Any ideas? Link to comment https://forums.phpfreaks.com/topic/203483-copy-images/#findComment-1066102 Share on other sites More sharing options...
-Karl- Posted June 1, 2010 Author Share Posted June 1, 2010 Umm, it works with a test image, but not one that's like image.gif?id=6527 Is there a way around this? Link to comment https://forums.phpfreaks.com/topic/203483-copy-images/#findComment-1066117 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.