You definitely would want a local solution instead of having to make 100 requests per page unless this is for some script that is used as a cron once in a while etc.
You could use curl to grab the http header of the resource.
<?php
function get_headers($url_to_check)
{
$ch = curl_init($url_to_check);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_NOBODY, TRUE);
curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
}
?>
<table border="1">
<tr>
<th>ID</th>
<th>Image</th>
</tr>
<?php
for($i=0; $i<=100; $i++)
{
$url = 'http://localhost/images/icon_'.$i.'_64x64.jpg';
if (get_headers($url) == 200) {
echo "<tr><td>".$i."</td><td><img src='".$url."' /></td></tr>";
}
}
?>
</table>
Alternatively, if it is really localhost, reference the image through the file structure instead of using a URL. Then use is_file as it would be much quicker than making the aforementioned http requests.