Fix "Unable to Find Package" NuGet Error in Visual Studio C#
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 clicking on it and getting the URL, you will find the file name is changed to another form and will be different from what you provided earlier Also images will not have any extensions 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.
1 Login into your Google Drive and find the image you want to use on the web page.
2 Right-click on the image you want in the blog or HTML IMG tag and click on Get Link.
3 In the popup, click on the Copy link
Then you will get the link in ClipBoard. It looks like this:
https://drive.google.com/file/d/1I1vdwg3U3OJ2Zs0PshPc9wVIC19IMNNa/view?usp=sharing
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.
4 Now, when you try to use this in the image tag in HTML as below.
When you open this HTML page in a web browser you will not get your image and the 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 get the URL ID of the image and in this above example, the URL ID is:
We must use this URL ID in below direct link syntax below.
Now your Direct Links become like this:
http://drive.google.com/uc?export=view&id=17EqBYdKTEXp43I4ITzRcWHPwr560a0Sn
Now let's insert this above direct link in the image tag in HTML as shown below.
Image:
In this way, we have generated an image tag and this gets successfully displayed in the web browser as shown below.
If you have a link with usp=sharing like as below
https://drive.google.com/file/d/17EqBYdKTEXp43I4ITzRcWHPwr560a0Sn/view?usp=sharing
Then you can use it on the website without usp=sharing as shown below.
https://drive.google.com/file/d/17EqBYdKTEXp43I4ITzRcWHPwr560a0Sn/
But But...
Let's look at some limitations of Google Drive
Some images in Google Drive that are private cannot work on the website. Furthermore, you cannot obtain links to photo collections and use them on your website, and only a single image can be used on your website's img src tag. Also, images should be in supported formats like PNG, jpg, jpeg, gif etc. We can consider these as limitations of Google Drive.
Conclusion:
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.