Google Drive allows you to store various types of content such as images, videos, PDFs, docs, applications, and many others, on their own Google hosting platform. In the case of images, Google Drive will generate its own version of the filename for each image you upload.
When you look carefully at the image name by right click on it and get the URL, you will find the file name is changed to another form and will be different from what you have provided earlier also images will not have any extension like jpg, png, etc. This is google's way of securing the images in Google Drive.
When you want to share a file from Google Drive in some pages or blogs and want to use it in the img src tag of HTML by directly copying the link from Google Drive, it won't work because Google has protected your file from unauthorized access outside the Google domain. Even if you have shared the images, no one can use them outside of the Google platform. They can, for example, only open that image in Google Drive, Google Photos, and so on.
However, there is a way to use the images stored in Google Drive with a few hacks, and here are the steps for using Google Drive Images in HTML, blogs, and websites.
Login into your Google Drive and find the image you want to use on the Webpage.
Right-click on the image you want in the blog or HTML IMG tag and click on Get Link.
In the popup, click on the Copy link
Then you will get the link in ClipBoard. It looks like this:
This is the shareable link. when you go to the web browser and open this link in a web browser then it will open it as shown below.
Now, when you try to use this in image tag in HTML as below.
When you open this HTML page in web browser then you will not get your image and page will look like this:
This shows that directly copying shareable links does not work.
To know how to use in IMG tag of HTML, you must have to get the URL ID of the image and in this above example, URL ID is:
We must use this URL ID in below direct link syntax below.
Now your Direct Links become like this:
Now let's insert this above direct link in the image tag in HTML as shown below.
In this way, we have generated an image tag and this gets successfully displayed in the web browser as shown below.
You can generate a direct link from a shareable image link and use it in your image tag HTML, or you can simply copy the generated direct link and paste it into any website where you want to share the image content.