my $pics_found = $#found_images + 1;
while (@found_galleries && @found_images <= $pics_to_find * 20)
{
# Remove one gallery link at a time until we're done.
my $gal_url = pop(@found_galleries);
my $gal = get($gal_url);
print "gal = $gal_url
";
# Extract the image URLs from the gallery page.
my @image_urls = $gal =~ m#(http://images\.imagefap\.com/images/thumb/\d+/\d+/\d+\.jpg)#g;
foreach my $img (@image_urls) { $img =~ s/thumb/full/ig; }
# Remove the images which are too big.
if ($limit_img_size eq "yes")
{
@image_urls = grep {
my $this_url = $_;
my $image = get($this_url);
my ($height, $width) = imgsize(\$image);
print "IMG $this_url is $height and $width
";
$height <= $max_height && $width <= $max_width
} @image_urls;
}
push @found_images, @image_urls;
}
####
gal = http://www.imagefap.com/gallery.php?gid=158098
IMG http://images.imagefap.com/images/full/5/190/190037365.jpg is and
IMG http://images.imagefap.com/images/full/6/804/804735625.jpg is and
IMG http://images.imagefap.com/images/full/7/478/478782005.jpg is and
IMG http://images.imagefap.com/images/full/10/199/1994599748.jpg is and
IMG http://images.imagefap.com/images/full/4/115/1151974238.jpg is and