Updated function that threw errors when no images were found on the post.