I am creating issues with https://developer.github.com/v3/issues/#create-an-issue. Is it possible to attach images to message body?
I tried 'Accept', 'application/vnd.github.v3.html+json'and emmbeded the image as img elment base64 encoded. The image will not show, but the ticket editor shows the img element.
There is no simple solution to this. The official docs say nothing about that which means it's not supported.
The GitHub.com authentication works based on cookies while the API authentication uses tokens/passwords. That means if you really want to hack the things to upload your image using GitHub, you have to login using a cookie which is probably more difficult than using a third-party image hosting website.
For example, you could just upload your image to imgur and then add it in the issue body:
![image-title](http://i.imgur.com/x....xx.png)
This will anyway be proxied by GitHub proxy and will be served offer HTTPs.
Related
how does GitHub support oembed?
According to this old gist
https://gist.github.com/skabber/54099
// URL scheme: http://gist.github.com/*
// API endpoint: http://gist.github.com/services/oembed/
// Example call: http://gist.github.com/services/oembed/?url=http%3A//gist.github.com/54099
But that unfortunately does not work. (I get http 404)
Now I know GitHub allows oembed because I can embed snippets in articles on medium.com
can somebody show me the URLs that I need to access GitHub Oembed services ?
p.s.
Just to help: had I asked the question for Flick instead of GitHub this URL would have been just the correct answer:
http://www.flickr.com/services/oembed/?format=json&url=http%3A//www.flickr.com/photos/bees/2341623661/
p.s. II
if somebody wonders why I am after this, it's because I want to see the JSON response provided by GitHub
GitHub does not provide oEmbed support for it's url. You can test with this oEmbed tester which tells you that the site is not oEmbed supported.
Medium doesn't unfurls its content with the help of oEmbed meta. It just takes the snapshot of the content (which would be displayed when opening the same url content in browser). Try the same by embedding a google doc content. You could get a clear picture of what medium does.
Medium uses embed.ly which is a api provider which provides embed content which could be easily added to your site.
I can successfully upload a png to FB's staging resources via the graph API: https://developers.facebook.com/docs/sharing/opengraph/object-api#objectapi-images-staging. This returns a URI of the form fbstaging://graph.facebook.com/staging_resources/XXX. The docs say:
Although this is a URI, it's for internal use only and is only a way to pass around an identifier. Referencing it as if it were an image will not return any useful data.
I'd like to use the staged image in a share dialog for the user, but for this I need a URL. When I pass the URI to ShareLink's image param (I'm using Unity's 7.2.2 FB plugin in Unity 5.2.4 but I think this is a generic issue?) I get an error because it expects image URLs to start with http:// or https://.
Is there a way to get the URL from this staging URI? The docs are unclear.
(You can phrase your answer in terms of the graph API explorer, I don't need a C# or Unity-specific answer)
After uploading an image, I get back metadata that has a mediaDownloadLink that will download the file when accessed. Is there a way to get a link that will display the image in the browser without downloading it?
In general, any object you set to be publicly accessible (which presumably you wanted to do to use it to host images on a website), you can then access with https://storage.googleapis.com/<bucket>/<object>. You can see this link also if you go to the cloud console and make an object publicly viewable and look for the Public link you can click.
If you have problems with the link downloading instead of displaying by itself in a browser, you may need to make sure the content-type header is set correctly; for example if using ByteArrayContent to upload data using the Java API, you'll want to set a string like "image/jpeg" in its constructor for "type".
So, I'm using the Facebook Graph API to upload a photo. Using curl, it goes something like this:
curl -F 'access_token={some access token}'
-F 'source=#/some/file/path/foo.png'
-F 'message=This is a test of programatic image uploading'
https://graph.facebook.com/me/photos
Now, this works fine if I have the file on the machine I'm making the request from. The issue is that the system I'm working on gets the image as a url (say, "http://example.com/foo.png"). I'd rather not download the image from example.com to my server just to upload it to facebook, since I have no need to keep it other than that. Is there any way I can just pass the url to facebook, or is this impossible?
(-F 'source=#http://example.com/foo.png' does not work)
In the past, we've simply downloaded the file locally to the server, then handled the upload and unlinked it. This way we're also able to be sure that the asset was available (servers/connections flaking out) to be uploaded in the first place. I don't believe you can initiate an upload and the media to come from a third-party (may be wrong though).
I'm trying to implement a feature like that where a user inputs a url and when displaying that url I want to have a custom display (an embed object if it's a video from youtube, a thumbnail if it's an image link, title and excerpt of body if it's a normal link).
How can such a feature be realized?
There is a new idea called oEmbed that a few sites support (Flickr, Vimeo and a few others) that addresses this problem. oEmbed site
Otherwise, just check the site against a list of ones you pick and then pull out the relevant bits to construct an embed link.
I liked the idea of oEmbed a lot but unfortunately it doesn't has that much adoption yet.
oohEmbed tries to solve this issue by building oEmbed for many websites.
For the feature to work, it needs the server's interaction where I believe the following scenario is how it works
Assume that we have the site humanzz.com and that it provides such feature
A user enters a url on the humanzz.com's webpage and presses a button like facebooks' preview button
An AJAX call is made to a dedicated page on humanzz.com
humanzz.com does calls the remote website and gets its data
The AJAX call now returns the page's data (oEmbed JSON object)
This involves so much server's overhead.
I really wanted to do it using JavaScript as the server's role was only to bypass "Same Origin Policy"'s restrictions.
oohEmbed allows bypassing the server's step by specifying a callback parameter to oohEmbed so that the JSON object returned is passed to a callback function on your page.
An example illustrating this is as follows
Add a script tag dynamically to your page
< script type="text/javascript" src="http://oohembed.com/oohembed/?url=http%3A//www.amazon.com/Myths-Innovation-Scott-Berkun/dp/0596527055/&callback=myCallBack">< /script>
This would result in executing myCallback(oEmbedJSONObject) which is great.
The problem with that solution is you still have to have a fallback for websites that don't have oEmbed representations.
For the embedded things, I have been using auto_html ( https://github.com/dejan/auto_html) with great success (vimeo, youtube, images) and even added soundcloud myself. But I am still looking for a "thumbnail" generation with an image and text facebook-like.
I guess you have to construct it by yourself by manually parsing the kind of URL you get.
If it is an image url, well then you just have to rescale it and in case the user clicks on it, then handle that by opening the original one somehow.
If it is a link to some youtube video, then you have to take a look at how the embedding of Youtube videos works. You can just copy the code that is provided by Youtube itself, and then exchange the parts with the URL to the video with the URL you got from your user.
I did never implement something like that, but I assume it should work somehow like this.