Jump to content

Copy image from URL to my server (5 million times)


brm5017

Recommended Posts

Ok, so I get a feed from an XML source which I've imported into my database. Within the feed, there is an image URL in the form of:

 

http://trend.trendrets.com:6103/platinum/getmedia?ID=70054419106&LOOT=50038672093

 

I want to take this image url and save the image it's referring to it to a folder on my server.

 

 

How do I go about doing this?

 

 

Errrrr.....  Do you really want to do that?  You'll probably want to store them on demand, not all at once.

 

If you stored them all at once, it would take days (maybe weeks) to download all of them.

 

 

Let's say 10KB an image....

 

10KB * 5000000 = 50000000KB = 47.6837158203125GB.  So......  Yeah.

 

 

 

 

Anyway, you would just do what auro said, or do file_get_contents or just do it with raw headers.  Which ever way you want to do it.

 

 

Just of curiosity, why are you ripping all of these photos?

Would you rather just use the images at those links on your web page or do you need to have a copy of them on your server?

 

The following will work on your web pages -

<img src='http://trend.trendrets.com:6103/platinum/getmedia?ID=70054419106&LOOT=50038672093' alt='your alt text here'>

 

If you truly want to get a copy of all the images, what part of the coding to do that do you need help with?

I'd like to put them on my server. I'm going to re-think this database design then post what i've come up with.

 

Right now, I've got 2 tables

 

Listings: (address, city, state, price, beds, bathrooms, etc.(there's 35 fields))

Listing_Pictures: (Picture URL(from the feed), PictureOrderNumber, ListingID)

 

 

 

There's a lot of redundant data in my URL's.  The only parts that change are the ID numbers and the LOOT numbers.

http://trend.trendrets.com:6103/platinum/getmedia?ID=70054419106&LOOT=50038672093

 

 

If I just extract the ID and LOOT from the url and store them in the database, then assign them to separate columns, this would greatly speed up the search, right?

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.