Creating a media browser for my site
My website's blogging system had a good start, but I'm going to need some more quality of life improvements. One of the most important and impactful features that came to mind was the ability to easily add images and videos to my posts. I remember how this worked in Wordpress, so I made something similar. My first question was: What's the most cost-effective and easy place to host my files? I asked Google Cloud's AI helper this, and it recommended a Cloud CDN + Cloud Storage combo. Cloud CDN is too expensive for my small low traffic site, so plain Cloud Storage will work fine.
I created a public Cloud Storage Bucket and added some test files. All of the files now have a public URL. I made a Svelte component that fetches and shows the files.
Next I added a file upload button. The file gets POSTed to the SvelteKit instance which then uploads it to Cloud storage. It uses the contentType to determine the most suitable folder for the file. The listing is now visible when I'm editing a post, and I can insert media to the current text cursor position by clicking on it.