问题
How do you upload images to a gist?
Take a look at this: https://gist.github.com/mbostock/5503544#file-thumbnail-png
What I have tried is drag-and-drop the image file while in the edit mode of a gists. That didn't seem to work under Crhome and FireFox.
Update: After a back and forth emails with GitHub, this feature (drag-and-drop binary files, images) isn't supported.
回答1:
I was looking for answer for the same question, here is what I just found:
You can clone your gist as a git repository and add your picture, then push to origin. See loading-thumbnail-into-gist-for.
There is a script written to do this: hecticjeff/gist-img.
I have not tried the above solutions yet, but pretty sure they should work. I did try using defunkt/gist to update my gist with a png but ended up displaying a binary file in my gist.
回答2:
With a little creativity you can achieve this faster than cloning. To drag/drop:
- Create the Gist
- Drag an image into the comment field below. This will upload your image file and insert the markdown code with the url for your uploaded image.
- Copy this markdown and paste it into the file you want to display it.
Live example
回答3:
- Create a gist or reuse one of your gists.
Clone your gist:
git clone https://gist.github.com/<hash>.git
Add your image to your gist's repository:
git add my-image.jpg
Commit the image:
git commit -m "adding my image to my gist"
Update gist by pushing you modifications:
git push origin master
回答4:
I was looking for an answer to this same question too, in my case in order to be able to upload PDF files. I had trouble with gist-img
(mentioned in another answer to this question). I searched some more and discovered gistup, which worked perfectly, the first time I tried it. It uses node and npm, so it should work on most major operating systems.
回答5:
How to put images in your Gist url:
- upload your image to a place like imgur.com for free, then get the hot-link.
- Add a file and give it a markdown extension
.md
and use markdown image syntax:
![alt text here](https://URL)
- ?????
- Profit
回答6:
Clone gist with SSH:
$ git clone git@gist.github.com:<hash>.git mygist
HTTP clone worked fine, but ran into HTTP authentication problems at git push
.
回答7:
uploading the image somewhere and using the HTML <img> tag works for me
回答8:
If you upload an image, try these steps:
- Convert your image into DataURI. For example here on duri.me
- Then this string insert to GIST as a text file
If you want to convert back, there are several options. For example, this: Converting data URI to image data
来源:https://stackoverflow.com/questions/16425770/how-do-you-upload-images-to-a-gist