I want to have a preview of some documents I upload using Util.getContentAnchorWithImageUrl() method

Viewed 13

I have a document where I can upload some content in their. how can I have a preview of those uploads in a listgrid using this method: Util.getContentAnchorWithImageUrl()?

1 Answers

Uploads are placed into the content management system immediately on upload and the newly assigned content identifier is placed into the document bean that the content was uploaded against.

At this point in time, the bean is not saved and so if the user discards the change, the uploaded content will be orphaned but will be removed by the content garbage collector.

Using admin.Contact document as an example, uploading a selfie against the image attribute through the UI will ensure that contact.setImage() is called with the corresponding content ID.

A call to

Util.getContentAnchorWithImageUrl(Contact.MODULE_NAME, Contact.DOCUMENT_NAME, Contact.imagePropertyName, bean.getImage(), true, 100, 100);

will create an anchored 100x100 thumbnail image that will open the uploaded image in a new browser tab when clicked.

Related