iCloud Photos lets you have your picture of a cake and shoot a video of eating it, too. You can create a library of images and movies that’s far larger than the storage space available on any linked iOS or macOS device without losing anything you’ve captured.
Apple accomplishes this by treating iCloud as the “truth.” It stores the original, high-resolution versions of your media in your iCloud storage, while providing the option to store only “optimized” or thumbnail versions that take up a fraction of the space on your Mac, iPhone, or iPad.
You can choose to download the full-scale originals, but you obviously need to have enough storage to hold the library.