Easy if you create a query handler;
example
function dosql($query)[
global $myHowMany;
if(!$myHowMany){
$myHowMany=1;
}
else{$myHowMany++;}
$result=mysql_query($query);
}
usage:
$x=dosql("SELECT database();")
while($row=mysql_fetch_array($x)){
$database=$row[0];
}
$x=dosql("INSERT INTO table SET field=1");
global $myHowMany;
echo "You ran $myHowMany queries";
the image size is a bit trickier; you'd need to add it to the dosql type query handler above based on the content and/or table definition of your db.