Image

An image can be attached to a post. Other types of content (HashTag, UserMentionTag, URLTag) can be combined with this type of content. Images are uploaded to a secure bucket and thumbnails are automatically generated.

Example: Here how to post image post with a Hashtag

String message = "Rio de Janeiro is a wonderful city #Brazil";

FeedPost feedPost = new FeedPost.Builder()
  .setMessage(message)
  .setImage(new File("rio_de_janeiro.jpg"))
  .setVisibility(AccessControl.PUBLIC)
  .build();

Feed createdFeed = session.getNewsFeed().blockingCreate(feedPost);
Photo photo = (Photo) createdFeed.getObject();
let message = "Rio de Janeiro is a wonderful city #Brazil"

let feedPost = try FeedPost.Builder()
  .setMessage(message)
  .setImage(UIImage(contentsOfFile: "rio_de_janeiro.jpg"))
  .setVisibility(.Public)
    .build()

let createdFeed = try session.newsFeed.blockingCreate(feedPost)
let photo = createdFeed?.object as? Photo
let post = (new FeedPost())
    .setMessage("This is a web link shared with all https://blog.algolia.com/supporting-open-source-projects")
    .setVisibility(AccessControl.Public)
    .setImage(new FileData().loadFromFileBrowser(blob));
let feed = await session.newsFeed.create(post);
let post = (new FeedPost())
    .setMessage("This is a web link shared with all https://blog.algolia.com/supporting-open-source-projects")
    .setVisibility(AccessControl.Public)
    .setImage(new FileData().loadFromFileBrowser(blob));
session.newsFeed.create(post).then((feed)=> {

});

Photo generated URLs looks like this.

{
  ...
  "url": "https://u470584465854a194805-msa-core-storage.s3.amazonaws.com/2375667195016462956/my+photos/92e61a9383444b958d61d0153e6b08713422350505586227997.jpg",
  "small_url": "https://u470584465854a194805-msa-core-storage.s3.amazonaws.com/2375667195016462956/my+photos/92e61a9383444b958d61d0153e6b08713422350505586227997-small.jpg",
  "medium_url": "https://u470584465854a194805-msa-core-storage.s3.amazonaws.com/2375667195016462956/my+photos/92e61a9383444b958d61d0153e6b08713422350505586227997-medium.jpg",
  "high_url": "https://u470584465854a194805-msa-core-storage.s3.amazonaws.com/2375667195016462956/my+photos/92e61a9383444b958d61d0153e6b08713422350505586227997-high.jpg"
  ...
}