How to post Video with custom thumbnail picture using RestFB? - java

I can publish video with description using RestFB. I want to add thumbnail picture to video. How can I do that?
I tried to add some Parameter when publish as
Parameter.with("thumb", BinaryAttachment.with(fileName, fetchBytesFromImage(fileName)))
Parameter.with("picture", BinaryAttachment.with(fileName, fetchBytesFromImage(fileName)))

If publishing more than one BinaryAttachment, you have to add the fieldname to the BinaryAttachment.with method , put both BinaryAttachments in a List and use it in the publish method.
It looks like this:
fbClient.publish("me/videos", GraphResponse.class,
Arrays.asList(
BinaryAttachment.with("source","1.mp4",inputstream),
BinaryAttachment.with("thumb", "bla.jpg", fetchBytesFromImage("bla.jpg"))),
Parameter.with("description", "Test Thumb"));

Related

Share text with picture to telegram

I want to create an app in Android and I want to share text with a picture to telegram but I do not want the pictures and the text to be separated. I don't know how to do this.
Hopefully it works fine, I tried same.
$.sendPhoto(image_url,{caption : 'i am attached text with image'});
//bot.sendPhoto(chatId,image_url,{caption : 'i am attached text with image'}); /* TRY these according to you.
Or, if you want to send it from Telegram rest api, then call this api:
API URL : 'https://api.telegram.org/bot'+token+'/sendPhoto?
chat_id='+chatID+'&photo='+imageSrc+'&caption='+(message ?message : '');
METHOD : GET

Picasa API not showing all google photos albums

I am using Picasa API to show user's google photos albums in my site.
I am using google's GData library. Here is my code:
PicasawebService service = new PicasawebService("MyApp");
service.setAuthSubToken("MyAccessToken");
Query query = generateQuery("https://picasaweb.google.com/data/feed/api/user/default");
query.setStringCustomParameter("kind", "album");
query.setMaxResults(1000);
UserFeed feed = service.getFeed(query, UserFeed.class);
Using this code I can see all of my albums - both old and new ones, but some users complain that they do not see all of their albums.
Any idea what can be the problem? Is it something in my code? or google photos isn't fully synced with picasa API?
Thanks.
Any idea what can be the problem? Is it something in my code? or
google photos isn't fully synced with picasa API?
It seems that this is a bug with the API. Albums created as "Shared Albums" don't appear in the API.
Steps to reproduce:
From the https://photos.google.com, click Upload and upload a picture.
In the popup shown after the image uploads, click Shared Album then New shared album and give it a name.
Confirm that the album exists at https://photos.google.com/albums and is marked as Shared.
Use the API to list your albums.
You'll find that the newly created album isn't visible via the API.
If you click Add to Album instead of Shared Album in step 2 above, the album will be visible via the API. If this unshared album is later shared, it remains visible. The problem only occurs if the album is shared when it is created.
The provided post is not working nowadays. One way to do it now is through google +.
Go to google+
Create a post and upload the photos that you want to share through picasa api and
publish the post.
Go to your home page google+ profile. In the new published post on the bottom left corner, you will see a "Show album" link, copy the link. It contains user id and album id accessible through picasa feeds.
Take into consideration that this is a hack that probably it gonna not work soon.

using square Picsso android library to load image from custom resource

I was very excited about Picasso android library . I have an android application that i want to use picasso but i have one problem in a place inside my application
I have a listview (endless) that display images in each item beside some text , now i don't have the Url for each item in the list ( I am using a stupid api ) , I have to hit the server with specific id ,then the server sent me image url(s) that i can use in Picasso .
example :
http://url/id/342
and the response look like
{
"images":["url_large":"http://........","url_medium":"http://........"]
}
I can't pre-load image url . because i have an endless list and for each item i need to call the web service to get it image url .
Can picasso handle this ?

Display Images in TextView html

I state that I have already read all the other questions but none is right for me.My app retrieves data from a database. If I put in the database in the app does not display the image, while the other tag html yes because i put:
Text = (TextView) this.findViewById(R.article.text);
String formattedText = db.getText();
Text.setText(Html.fromHtml(formattedText));
For images I would like something that the download so that they are always available. I tried to put ImageGetter but with the loading time of an article in the app increased a lot and very often said that Android is not responding (ANR). I also need something that resizes images depending on the display. Any ideas?
Take a look at AQuery download the latest jar add it in your project
and use it like following
AQuerymAQuery;
mAquery=new AQuery(context);
mAquery.id(ImageView).auth(handle).image(ImagePath,true,true,400,0,null,0,0.0f);

Javascript/html - File upload

I have a news section where I can post some news.
-> Thumbnail , title and content
What I want:
The user should be able to upload an image file without leaving the page
-> progress bar
Send the file as a post request to my server.
Then I can get the image file from the post request, then I can resize/rename the image and upload it to amazon s3.
If I have to use a javascript library, I would prefere to use jquery.
This should looks something like this:
If I submit the news, I want to save the image path in my database. Now I would need a way to get the image name from my post method.
I've found some uploading solutions, but I have problems to understand how they are working.
http://blueimp.github.com/jQuery-File-Upload/
http://www.uploadify.com/
I only know get/post to retrieve information but they integrate somehow php files in the form.
for example:
$(function() {
$('#file_upload').uploadify({
'swf' : 'uploadify.swf',
'uploader' : 'uploadify.php'
// Put your options here
});
});
I am lacking information to do this on my own. What would you recommend me?
Ps: I am using Java with Play2
Uploadify is definitely the way to go.
All the steps for implementation are to be found here : http://www.uploadify.com/documentation/uploadify/implementing-uploadify/
You need to configure the path where your uploads go in the uploadify.php script.
As for amazon S3 here is an implementation : http://code.google.com/p/uploadify-amazon-s3/
I think onUploadSuccess method better fits than onSelect : http://www.uploadify.com/documentation/uploadify/onuploadsuccess/
You can do something like this from the documentation :
$(function() {
$("#file_upload").uploadify({
'swf' : '/uploadify/uploadify.swf',
'uploader' : '/uploadify/uploadify.php',
'onSelect' : function(file) {
alert('The file ' + file.name + ' was added to the queue.');
}
});
});
Where you can get the flename once it has been selected.
What you're asking for is a LOT really. But to get you started, have a look at this page (uses JQuery):
http://tutorialzine.com/2011/09/html5-file-upload-jquery-php/
The above link is a nice upload utility that you can use for drag-and-drop pretty easily, but it can be used by manually selecting files as well. Well documented.
As for resizing, I've used this with great success (PHP): simpleImage
simpleImage is REALLY easy to use and plug into your website.

Categories