Php Script To Pull Images From Remote Server And Resave Csv

There are two tasks to this job:

1. Download images from a remote server. I have 2 large csv files. The files contain various data columns followed by image column(s). One csv file has each image in a separate column while the other has all images in one column separated by commas. All images are represented by full urls. I need a script created for each csv file that reads the image urls in the file and downloads all images to a directory on my server.

2. Now, the script needs to also copy the csv file and in the copied file rename all the image urls to my servers domain and folder path. So basically a find and replace; finding http://www.remoteserver.com/images/dealer/img.jpg and replacing it with http://www.mydomain.com/path/tomy/images/dealer/img.jpg

I attached sample csv’s so you can see the format. The actual csv’s have up to about 2,000 rows of data, each row having about 10 images. Consideration needs to be taken so that the script will not timeout. I would estimate that each feed could easily have 200MB – 800MB of images to download. This script, when complete, could run on a daily basis, so consideration needs to be taken to not overwrite unchanged images. Many images will be the same since the script was run last, so there needs to be some function to see if file exists before copying to ensure best performance.

Project needs to be completed very quickly, in 1 to 2 days.

Leave a Reply

Your email address will not be published. Required fields are marked *