Is it possible to attach an image to a tweet using the Twitter share link?
I'm using the following url to tweet but I can't find away to attach an image. The tweet has a link to the image but I want it attached to the tweet so someone can view the image while reading the tweet.
https://twitter.com/intent/tweet?hashtags=MyTag&url=http%3A%2F%2Ftest.com%2Fimage.png
Or would have to use the twitter api?
I would recommend using https://tweetinvi.codeplex.com/documentation which you can programmer directly with twitter.
// Publish with media
byte[] file = File.ReadAllBytes(filePath);
var tweet = Tweet.CreateTweetWithMedia("I love tweetinvi", file);
var imageURL = tweet.Entities.Medias.First().MediaURL;
// Publish with geo information
var tweet = Tweet.CreateTweet("Hello guys");
tweet.PublishWithGeo(-54.73, -64.2);
// Retweet
tweet.PublishRetweet();
I do not believe it is possible to upload media through the share link. Probably, a security decision by Twitter.
I suggest you try the twitpic API.
Related
I'm trying to upload selected image by MIT App Inventor II. What I did is to download an extension which encodes image to base64 coding, and then call Web1 to address Google App Script. Actually, what I did is just follow an YouTube channel, but somehow it does not work.
function doPost(e) {
var data = Utilities.base64Decode(e.parameters.data);
var blob = Utilities.newBlob(data,e.parameters.mimetype,e.parameters.filename);
var folderid = Utilities.base64Decode(e.parameters.folderid);
DriveApp.getFileById(folderid).createFile(blob);
return ContentService.createTextOutput("Your File Successfuly Uploaded");
}
Combining with Taifun's Extension. These blocks are confirmed to be able to do as below.
Display the ImagePicker selected image on the Image component
Encode the ImagePicker selected image to a Base64 string.
Send the string to URL (Google App Script)
I can't find any resource to embed google Picker in a flutter to upload a doc to Google drive. Can any provide me with an example of how to integrate Google Picker to Flutter?
Same issue here, you can use file_picker:
final result = await FilePicker.platform.pickFiles();
It will navigate user to an UI for selecting files including other app's files, i.e. google drive.
BTW, you should request permissions before picking the file:
final googleSignIn = GoogleSignIn(scopes: []);
await googleSignIn.signIn()
// request when you need it!
await googleSignIn.requestScopes([SheetsApi.spreadsheetsScope])
Found similar question here: File Picker for Google Drive Rest API for Android
I posted this as an answer to a related question but it was deleted by a moderator, so I'm posting this now as a question. The related question is
Accessing shared albums from Google Photos
I am trying to access a Google Photos shared album using JavaScript. Public albums created with Picasa are easier to deal with using the Picasa Web Albums Data API.
I've developed a peculiar solution parsing the HTML contents of a shared album URL, such as
https://photos.google.com/share/<album>?key=<key>
The parsing function is
function getgooglephotos2(result)
{
var r2 = result.substr(result.search("AF_initDataCallback\\("));
var r3 = r2.substr(0, r2.search("https://video"));
var img = r3.search("https:");
while (img != -1) {
var r4 = r3.substr(img);
var imgend = r4.search("\"");
var r5 = r4.substr(0, imgend);
// r5 contains an image url
r3 = r4.substr(imgend);
img = r3.search("https:");
}
}
I would prefer a cleaner approach. Any idea?
Thanks.
PS: it seems that using authentication, I can reach a Google Photos shared album, but I am trying to implement a solution that doesn't require authentication for shared (public) albums. Here's a link
https://adodson.com/hello.js/demos/albums.html
A simpler approach to test this is
Authenticate on picasa and fetch your userid
https://picasaweb.google.com
After authentication you will reach
https://get.google.com/albumarchive/<userid>?source=pwa
Get your album list using the Picasa Web Albums Data API
https://picasaweb.google.com/data/feed/api/user/<userid>
I'm just developing app that doesn't require authentication. Anyway somehow you need to point out which album should be displaying. In my project I'm using Firebase to store URLs to shared albums. Then I request the URL and get photos using regex. To retrieve the photos I used this tutorial:
https://medium.com/#ValentinHervieu/how-i-used-google-photos-to-host-my-website-pictures-gallery-d49f037c8e3c
At the moment there is no way to access shared albums directly from Google Photos without authentication.
I'm using Spring Social and I create the Facebook Connection, I'm able to retrieve user's profile picture, but in case the user doesn't have a profile picture the result is default facebook user profile picture. How to determine if user has a uploaded photo ?
Facebook facebookApi = (Facebook) connection.getApi();
facebookApi.userOperations().getUserProfileImage(250, 250);
I looked for every available methods and there is nothing nor any data which allow me to determine this.
How to solve this ?
If you have connection, you can upload image from url:
String imagUrl = connection.getImageUrl();
URL url = new URL(imagUrl);
BufferedImage image = ImageIO.read(url);
To change dimension of uploaded image you can use "type" imagUrl += "?type=large";
I'm trying to share a photo using FBSDKSharePhotoContent and make the applink works but I bang my head to make it works.
My app is mobile only so the photos are not hosted on any web site.
I use this code to share the photo:
let photo = FBSDKSharePhoto()
photo.image = currentHeaderImage
photo.userGenerated = false
let photoContent = FBSDKSharePhotoContent()
photoContent.photos = [photo]
photoContent.hashtag = FBSDKHashtag(string: "#Showflix")
photoContent.contentURL = NSURL(string: "applink...")
FBSDKShareDialog.showFromViewController(self, withContent: photoContent, delegate: nil)
I generated the applink using the Facebook Developer site interface.
The photo is corretly published on Facebook but there are no link in the post. If I click on the photo it only open a normal photo on facebook.
I tried also using photo.imageUrl, I tried also FBSDKShareDialog without success.
All I need is to share a photo on Facebook user wall and if someone clicks on this photo it should propose to open it in the mobile app.
Thanks for help