Image attachment check belongs in attachments.php