This spits out a whole heap of NO's but the images are there and path correct as they are displayed by <img>
.
foreach ($imageNames as $imageName)
{
$image = 'http://path/' . $imageName . '.jpg';
if (file_exists($image)) {
echo 'YES';
} else {
echo 'NO';
}
echo '<img src="' . $image . '">';
}