Share image on Twitter without a card

Given an image with a specific address, http://www.thissite.will/never/be-finished.png , what is the easiest way to share it on Twitter, preferably without a map?


The user configures the SVG, and when they are satisfied, I convert it to PNG and save it on my server.

I want to give them the opportunity to share their image on Twitter. They click on the button (which I can implement) and a dialog box opens where they can add to the tweet (which should already contain the image).

I know that similar questions have been asked on this site before, but I do not want to use a โ€œmapโ€ to share the image. Instead, I want a typical, non-card Tweet, only with an image (like this ).

I have repeatedly looked at the Twitter Developer documentation, but I cannot find useful information. The POST method status / update_with_media is out of date, and the link to the Media Download Guide, the proposed replacement, is broken. This guide , I suppose, is what it is intended for reference to, but it does not have JavaScript code to suggest how this should be implemented.

Please, help.


My attempt based on POST media/upload :

 $.ajax({ url: "https://upload.twitter.com/1.1/media/upload.json", format: "post", data: {"data" : link} }).success(function(response) { console.log(":)"); console.log(response); }).fail(function(response) { console.log(":("); console.log(response.responseText); }); 

It fails. responseText - {"errors":[{"code":215,"message":"Bad Authentication data."}]} .


Basically, I want to do something similar to what StackOverflow does. When you click โ€œshareโ€ a question, then select โ€œTwitterโ€, a new window will appear, filled with a link to the question and where users can write their own message. (Twitter provides an interface.)

In my case, however, when a tweet is sent, and then a link to the page appears and some text extracted from it, I would like to have only an image.

+7
javascript oauth svg twitter sharing
source share
1 answer

Twitter has no official way to share images. You must use a twitter card . This is my one nice page . Check this URL on the Twitter map validator , you will get a pretty image. This is similar to your example with reference to the Bloomberg twitter status. Now you can click this link for the tweet that belongs to my this web page (of course, you can delete this tweet, this is an example for testing). You will get a large image with the ability to customize text. This is what you wanted.

Hyperlink Options Above Twitter

The hyperlink I gave you is similar:

 https://twitter.com/intent/tweet?text=Cheapest%20CDNs%20With%20HTTPS%2C%20IPv6%2C%20HTTP%2F2%2C%20Brotli&url=https%3A%2F%2Fthecustomizewindows.com%2F2017%2F06%2Fcheapest-cdns-https-ipv6-http2-brotli%2F&hastag=AbhishekGhosh&via=AbhishekCTRL&original_referer=https%3A%2F%2Fthecustomizewindows.com%2F2017%2F06%2Fcheapest-cdns-https-ipv6-http2-brotli%2F 

https://twitter.com/intent/tweet is a permanent part. ?text= is what text you want. &url= is the URL you pass. &via= is an optional linked account. &original_referer= in most cases the same as &url= , &hashtags - the hostages you want. &hashtags does not work.

But you want the image to not be a web page. It's complicated.

What you need

Why do you need web-based software with PHP-MySQL like a pair. The application will write a unique overtime user URL to finish working with the HTML markup for the Twitter map for the user-created webpage with the image. Twitter map is a question of how on a web page there are layouts, images, domain webmaster settings, etc. You can set this preferred image using HTML markup of a web page using the PHP language.

Prototype example

As an example of such a thought for development with WordPress, when I did not publish the article, I had an image, but the preview URL was closed. In WordPress, it's possible to publish an unpublished article. As a basic example, 4 WordPress plugins can be tested:

Of course, there is a new WordPress API for this from another server.

0
source share

All Articles