The advantage of using this is that instead of storing say an image in your database, you instead, upload the image to GCS and get a link/url to that file in which you can then store into your database hence, saving disk space in your database and reducing time spent in trying to backup your data. Google cloud storage is a service on GCP that allows you to store static files like images and files. Google Cloud platforms offer a range of cloud-based services but the one we are going to be focusing on is going to be Google Cloud Storage. In this tutorial, we will be using Google’s cloud-based service known as Google Cloud Platform. A lot of companies offer these cloud-based services including Tech Giants like Amazon and Google. One of the advantages of using the Cloud is because of how elastic, accessible, and secure it can be. The Cloud is just a remote server sitting somewhere, where you can store your content and access them quickly, easily, securely, and from anywhere in the world. The best option is to use an online file storage web service on the cloud. However, serving just images with a CDN can be very expensive, and the thing is, since CDN tends to thrive by caching contents, you might have uploaded a new image or file but it wouldn’t be available to the users until you clear the cache. A Content Delivery network is often used to accelerate the effectiveness and efficiency of serving contents from a server to the clients by caching them and making them available to the clients as quick as possible. Another way this problem can be solved is to serve our files with a CDN (Content Delivery Network). Solutions to these problems could either be to Store our images in the file system, and create links/pointers to these images in the database but this could be slow when we need to fetch those images. In this relatively short tutorial, I’ll be showing you how to upload an image to Google Cloud Storage and also how you can resize the image.Īs developers, one of the things we shouldn’t do is to always store an Image to our database as this could open up our application to all sort security vulnerabilities, it also eats up unnecessary space in our database since they are stored as a blob file, and finally, it could lead to an increase in the cost of backing up data.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |