If you know for certain that the file extension is always going to be four characters long (e.g. ".jpg"), you can simply use substr()
where you output the filename:
echo substr($filename, 0, -4);
If there's a chance that there will be images with more or less characters in the file extension (e.g. ".jpeg"), you will need to find out where the last period is. Since you're outputting the filename from the first character, that period's position can be used to indicate the number of characters you want to display:
$period_position = strrpos($filename, ".");
echo substr($filename, 0, $period_position);
For information about these functions, check out the PHP manual at http://php.net/substr and http://php.net/strrpos.