Copying multiple images from a remote server |
[eluser]Unknown[/eluser]
This is my first code snippet therefore constructive criticism is very welcome! I'm just starting to work with affiliate product feeds and I wanted product images to be served locally rather than being served by an external site. So, with the help of the cURL library, as created by Phil Sturgeon (https://github.com/philsturgeon/codeigniter-curl), I knocked up the following in 10 minutes to grab each image in a feed and store a local copy with the same filename. Code: function import_photos() The code assumes that you have a table called tmp with a field called photo that contains the urls of each image. The images directory must be writeable and the cURL library is autoloaded in autoload.php |
Welcome Guest, Not a member yet? Register Sign In |