An infinite low cost, highly available storage option is a CDN (content delivery network). A CDN will auto scale to accommodate any data storage need. It will do so at 0 to no cost depending on the vendor. A server hosting media assets is restricted to the storage space of the server. That infrastructure costs real hard cash and even in cloud the cost can be significant because nodes (virtual servers) are leased based on size, cpu. The cost of nodes drastically increases as more cpu and storage is needed. The 0 cost option is a CDN.
Furthermore, with a CDN you can maintain complete control over all assets putting aside the vendor off course. However, assets in a CDN can be lifted shifted to other CDNs fairly easily. Assets stored in a CDN are fairly portable and can easily be moved around.
Also, serving media from servers creates arguably unnecessary architectural complexity and maintainaince. With a CDN all this hassle is eliminated.
With a CDN like AWS s3 + cloudfront you can rest assured that media is safe, highly available, scalable and easily accessed.
I store all my online content inside a CDN set-up like I just described. Never have to worry about a company pulling a fast one like what was described by a previous post.
I even host entire sites on a CDN without a server to deal with. Everything just works don’t have to worry about scaling for traffic, load outages, memory consumption or a complexity and pain of managing a virtual server or god forbid a pyhsical server.
This looks like it might be useful if this is something you want to explore.
Azure, digital ocean, just about any cloud service will have a away to setup a CDN. I’m only familar with AWS though so that is what I can directly recommend.
This is something I have used in the past to easily upload media assets to aws s3.
The docs for the s3 adaptor.
https://flysystem.thephpleague.com/docs/adapter/aws-s3-v3/
I think this adaptor would allow you store media assets in a gitlab repo and easily upload them. The assets could be served via turning the gitlab repo into a free hosted pages site.
https://flysystem.thephpleague.com/docs/adapter/gitlab/
So as you can see there are a lot of modern ways to go about this without resorting to limited self managed server(s) option.
These topics can’t be covered in a book for a beginners. I’m not even sure the CDN option is explored in any php book. The php crowd tends to be very set in their ways. However, if you go outside and take a look around there is an entire world out there with innovation eliminating many pitfalls of cookie cutter php dev.