$count=0;
$sth->bind_columns(\($siteid, $imageurl));
while($sth->fetch()) {
$sites{$siteid}=$imageurl;
$count++;
}
####
$sth->bind_columns(\($siteid, $imageurl));
while($sth->fetch()) {
$sites{$siteid} = $imageurl;
}
$count = keys %sites;
##
##
my $error = 1;
if ( my($type, $size) = ( head($imageurl) )[0, 1] ) {
if ($size < 25600) {
if($type =~ /image\/(gif|jpeg)/) {
print "OK ($size bytes, $type)\n";
$error = 0;
} else {
print "Wrong file type ($type, must be image/gif or image/jpeg)\n";
}
} else {
print "Image size exceeded ($size bytes, should be < 25600)\n";
}
} else {
print "Error\n";
}
if ( $error ) {
print FILE "update big_ass_table set imagedown=imagedown+1 where siteid=$siteid and imageurl='$imageurl';\n";
} else {
print FILE "update big_ass_table set imagedown=0 where siteid=$siteid and imageurl='$imageurl';\n";
}