I've been messing around with this for ages now without finding a solution - I am taking a set of images from the internet and printing a thumbnail to my server. However when I run the script only a haphazard subset of the full set is written to file - I have to run the script a few times to get all the images

Could anyone test this to see if it an error in the code or otherwise what might be going wrong? Thanks.

#!/usr/bin/perl -w use strict; use Image::Magick; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); print "Content-type: text/html\n\n"; my @names = qw( http://www.coldwellbanker.com/imgs/property2002/205/14692047_1.jpg.266 +x200 http://www.coldwellbanker.com/imgs/property2002/78/14692047_2.jpg.266x +200 http://www.coldwellbanker.com/imgs/property2002/463/14692047_3.jpg.266 +x200 http://www.coldwellbanker.com/imgs/property2002/336/14692047_4.jpg.266 +x200 http://www.coldwellbanker.com/imgs/property2002/209/14692047_5.jpg.266 +x200 http://www.coldwellbanker.com/imgs/property2002/82/14692047_6.jpg.266x +200 http://www.coldwellbanker.com/imgs/property2002/467/14692047_7.jpg.266 +x200 http://www.coldwellbanker.com/imgs/property2002/340/14692047_8.jpg.266 +x200 ); my $count; foreach my $item (@names) { $count++; my $photo = '../photo' . $count . '.jpg'; my $image = Image::Magick->new(magick=>'JPEG'); my $x = $image->Read($item); $x = $image->Scale(width=>'50', height=> '50'); $x = $image->Write($photo); print qq~<img src="http://www.mysite.com/$photo"><br>~; } exit();
Additional note: All of the lines are printed, 1 to 8, but some of the 'Write' are ignored, as mentioned previously, in haphazard manner.

In reply to Image::Magick not printing all images by jonnyfolk

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.