Search code examples
javathumbnailsbox-apiboxapiv2

Retrive different thumb dimension from BoxClient [Box.com JavaSDK]


This code retrive correctly the 32x32 thumbnail of the file:

BoxClient boxClient = getBoxClient();
BoxThumbnail thumb = boxClient.getFilesManager().getThumbnail(assetId, "png", null);

But what if I want to get the 128x128 or 256x256 thumb? I cannot found the param or a method to retrive this thumb.

Is there any magic tricks that I can do in order to get what I want?


Solution

  • instead of passing that null at the end, create a BoxImageRequestObject

    BoxClient boxClient = getBoxClient();
    BoxImageRequestObject requestObject = new BoxImageRequestObject();
    requestObject.setMinWidth(255);
    BoxThumbnail thumb = boxClient.getFilesManager().getThumbnail(assetId, "png", null);