Hi,

I have an "import" script that I'm using, which "grabs" images from one of our other sites - and then inserts them into itself. The code is as follows:
$tmp[3] =~ s/^\[|\]$//g; foreach ( split /,/, $tmp[3]) { my $ext = (reverse split /\./, $_)[0]; my $fname = "/home/user/public_html/cgi-bin/links/admin/IMPORT/tmp +_images/" . CORE::time() . random_string() . ".$ext"; `wget --quiet -O $fname "$fname" "$_"`; $hit->{"Image$images_count"} = GT::SQL::File->open($fname); $images_count++; }


This is ok - but its pretty slow. Is there a better way to "grab" all the images at once? Would that even make a difference? (we have potentially 13 images per listing, and over 13,000 listings).

What I was thinking of, is getting all 13 of those images at once... and THEN doing the loop (without individual requests, which I guess is whats slowing it down)

Any suggestions?

TIA

Andy

In reply to Quicker way to batch grab images? by ultranerds

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.