I'm uploading a folder of images for a project to GitHub and I want to display them in Flask.
<img src="https://github.com/madelinekinnaird/Gerrymandr/blob/master/images/az1.PNG">
I'm having trouble getting this to work. Do I need to use another image storage site, or is it possible to use GitHub for this purpose?
You can drag and drop the image from your computer to a comment field in GitHub. Wait for the file to upload and then the URL to the image is right there! You don't even have to submit the issue if you don't want to (although that may limit the image's lifespan).
GitHub remains one of the most reliable repository website for code, but we can also utilize its storage capability to host images for our website. The easiest way is simply to upload/push image files to your GitHub repo and get the link from the web.
Your approach looks correct. However, you are linking to the file in the github repository. Instead, you should link to image itself. You can get the link by right clicking on the image and select "copy image address".
In your case the link would be:
https://github.com/madelinekinnaird/Gerrymandr/blob/master/images/az1.PNG?raw=true
Assuming your image are located at
https://github.com/userName/ImageRepo
Than to access that image from a browser use below link https://raw.githubusercontent.com/userName/ImageRepo/master/FileName.ext
eg: location: https://github.com/pavanghai/images/blob/master/wine_scatter.jpg
Browser link: https://raw.githubusercontent.com/pavanghai/images/master/wine_scatter.jpg
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With