birkir / prime

✨Open Source GraphQL CMS
https://docs.primecms.app
MIT License
1.72k stars 113 forks source link

Alternative storage for image assets? #101

Open willangley opened 5 years ago

willangley commented 5 years ago

Cloudinary is an amazing service, but if you run out of credits it's $89 to unbreak things for a month.

A back-of-the-envelope calculation suggests I can get 1/4 of the way by syncing all of my Google Photos to a Prime CMS instance, even if no one looks at them, which makes me question whether I'd fit within a free plan if someone does 😜

I don't have a path to making money from from page views in mind, or a startup of my own that I can share an API key with, so this is a little scary.

Are there plans for a prime-field-asset variant that stores images locally / in low-cost general purpose cloud storage? It wouldn't need to resize images to be useful, since Gatsby can do this for static sites and programs like willnorris/imageproxy can do this for dynamic sites.

And if there aren't and I wanted to write one, would it make sense to add to prime-field-asset (to keep the editing options the field offers today,) or to make additional derived field types (prime-field-cloudinary-asset, prime-field-local-asset, ...) ?

birkir commented 5 years ago

This is a great idea.

Because of my MVP goal, I decided to go with cloudinary to get up and running as quickly as possible with the thumbnails feature (like Prismic has), but the end-goal would be to have a local version that does the same thing!

So the idea could be to have prime-field-asset independent of any storage solution, but you could install different drivers for this purpose, (Local, Cloudinary, S3, etc.) or have them baked in, IDK.

Also I want to checkout https://github.com/spacechop/spacechop

agustif commented 5 years ago

spacechop looks promising, a great implementation of this local images would be to let users to save avatars in localhost, as is done in a lot of forums, sometimes even as plaintext in database (Im not saying let's do that! though!)

intellix commented 5 years ago

Images uploaded to an S3 bucket with on-the-fly transformations via Lambda function would make it cheaper and in-keeping with the idea of being self-hosted/managed

irisjae commented 4 years ago

I've done a proof-of-concept for that here, will eventually add more documentation and stuffs to help out https://github.com/irisjae/prime