Image Hosting With Google Drive - Use Google Drive As A Image Hosting Provider For Your Website
When hosting your website, sometimes there is a requirement to host a lot of images.
Hosting images on the internet can be a costly affair. If you want to host and serve your images for your website over the internet, you can use your web hosting provider.
But as an alternate, there can be an easier way to publish and use images for your website.
Google Drive can be an amazing alternate where you can upload your images and use them in your website.
Let's see how can we do this.
In order to use Google Drive as an image hosting provider, you have to have a Google account.
Once you are logged in to Google Drive, create a new folder for your website, or just a general folder where you will upload all the images for your website.
For this example, I have created a website folder in which I will upload the images that I want to host on my website.
As a first step, I will upload the image to Google Drive. Use the File Upload option to upload a file.
I have uploaded my example image to Google Drive.
The next step is to click get the URL of this image so that we can use it on any public website.
"Right Click" on the image and click on the "Share" option.
On the "Share" tab, click on "copy" button and change the sharing options to "Anybody with a link"
Changing Google Drive Url To Public Image URL
The image that we uploaded to Google Drive had a link below:
From this URL, we get the ID of the image.
The Id of the image is the part that follows "/d" and ends before "/view".
In our example, the Id of the image is "1noLjNRv0xLcYIX_DBbKnCoWjSLhGpGa7"
Now let's replace this Id in the URL below:
The new public URL for this image now becomes
Public Image URL from Google Drive - https://drive.google.com/uc?id=1noLjNRv0xLcYIX_DBbKnCoWjSLhGpGa7
Now, we can use this URL inside an image tag and our website will be able to load this image that is hosted on Google Drive.
The output of the above looks like below: (Image hosted on Google Drive and used in our website)