With iCloud Photo Library you can take endless photos on an iPhone or iPad, or upload endless images on a Mac or via iCloud.com, as long as you’re paying for the right quantity of iCloud storage. And Apple simply manages it for you.
This trick comes through optimized storage, which is enabled by default in iOS when you turn on iCloud Photo Library. On the Mac, you have to turn it on: In the Photos app, go to Preferences > iCloud, check the iCloud Photo Library option, and then pick either to Download Originals to the Mac or Optimize Mac Storage. (I use full-resolution downloads on one of my Macs, a desktop machine, so I have a local copy that I can also backup elsewhere.)