I want to get image from a github repository and show it in my website.
Say, I have a image in my github-repo called banner.png. I have been successful at getting the content of README.md file which is a plain text. But images are binary thus I don't know how to get them (or just a url to that image) to use in img tag. I've searched and the blob does have a commitUrl but I don't know what that is for. I've tried using as the src for img but it doesn't work. I've even tried visiting that url but it just give a 404 not found.
Get Image from Github repo using GraphQL [Javascript]
439 Views Asked by Anish Silwal At
1
There are 1 best solutions below
Related Questions in GITHUB
- How do I create my own Git branch to work on?
- Tools for Apache Cordova - Installed Plugins are skipped in build
- Permission denied hg-git
- git hard reset - what am I doing wrong?
- Merge Pull Request Manually
- rebasing interactively, but only one commit shows up?
- Error when adding a new build stage on Bluemix DevOps Services
- What should I do if I put MS Office (e.g. .docx) or OpenOffice( e.g. .odt) document into a git repository?
- How to trigger git hooks without pushing to the repo
- How to push a Git server repository issues to Github repository?
- How to backup an AOSP project on GitHub
- How to reference comments in github.com?
- Aptana, github & remote (sftp) files
- Opening PDF in a browser with Github Pages
- I need git to include the parent directory
Related Questions in GRAPHQL
- How to define Relay fragment for GraphQLList of GraphQLObjectType?
- relayjs: Attempted to add an ID already in GraphQLSegment:
- Authorization in GraphQL servers
- How does graphql-java library execute Relay requests?
- GraphQL or REST
- relayjs and graphql error: Error: "Node" expects field "id"
- unable to render nested props from Github's GraphQL
- Single-Page App Sharing Relay Variables
- Relay and ReactJS give an error when connecting to Github's GraphQL
- Why does Relay need a mutation id to reconcile GraphQL mutations?
- GraphQL mutation operation in single transaction
- Documenting GraphQL short-hand model
- How to build a GraphQL API on top of a Django/Elasticsearch/MySQL backend?
- How to get all user model with GraphQL
- How to fetch data with apollo and react native
Related Questions in GITHUB-API
- How do I return what I want in this array of objects?
- Print out repository releases with go-github
- GitHub release asset download with node.js
- Starring a repository with the github API
- URL encoding issues with curly braces
- Read all commits for a project using the GitHub API
- Get private repos stats with Github API and ruby
- Using Github API code search, find the exact string `throw "`
- Getting incomplete response from GitHub API
- Python append json to json file in a while loop
- GitHub API returned Url meaning
- Java GitHub API -org.kohsuke.github Clone repository to Local Machine
- Link to download latest version tag of a repository from GitHub
- Getting "closed from commit X" from Github API?
- Get Github total clone statistics
Related Questions in GITHUB-GRAPHQL
- GitHub GraphQL to Read Repository Contents
- How to get Readme.MD from Github Graphql API?
- How to compare two branches in github with GraphQL?
- Is there a programmatic way to get the "Tracked By" relationship for github issues
- How to get comment Node ID of a discussion in GitHub Action with GitHub GraphQL API
- How to get the content of a specific discussion comment graphql query?
- GitHub GraphQL API: Is a user suspended?
- github graphQL API - how to retrieve issue's project items?
- ApolloClient v3 fetchMore with nested query results
- What does 'isLocked' field in the Repository object refer to in GraphQL API?
- In Github's GraphQL API how to get repositories that do not have a particular repositoryTopic?
- When should you not use GitHub GraphQL API?
- How can I pass multiple cursors to a single GitHub GraphQL query with multiple node ids?
- How to get all comments along with issues with github graphql
- is it possible to squash commits via Github API?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
If your repo is public, you can use a free hosting solution such as https://www.jsdelivr.com which can serve the file from Github (https://www.jsdelivr.com/features#gh) with the right content-type. You just have to build the url according to :
A few example :
https://cdn.jsdelivr.net/gh/bertrandmartel/newhaven-oled-dk51@master/img/newhaven-dk51.jpg https://cdn.jsdelivr.net/gh/bertrandmartel/websocket-java@master/exemples/readme_images/clientSide.png https://cdn.jsdelivr.net/gh/bertrandmartel/fritzing-parts@master/metec-braille-line-20-cell/metec-braille-line-20-cell.svg