- Nuxeo Web UI
This cookbook is oriented for Picture
and Video
document subtypes.
In Nuxeo Platform, when a Picture
or Video
is imported, renditions are generated automatically. By default, Nuxeo only allow the user to download a rendition. If you need to set a specific preview or thumbnail for a video instead of the random picture extraction or when the preview quality/content is not satisfying, you will need to replace that rendition: this contribution will solve these issues by providing an easy way to replace any rendition in the rendition list.
Replace a rendition with a custom one in the rendition panel.
The contribution is composed of the following element:
custom-rendition-update-blob-action.html
: the element that contains the button and the modal to update the rendition.custom-picture-formats.html
: the updated version ofnuxeo-picture-formats
that contains thecustom-rendition-update-blob-action.html
elementcustom-video-conversions.html
: the updated version ofnuxeo-video-conversions
that contains thecustom-rendition-update-blob-action.html
elementcustom-replace-blob-button.html
: the updated version ofnuxeo-replace-blob-button.html
that is used to control/filter the file type during the importcustom-dropzone.html
: the updated version ofnuxeo-dropzone.html
that is used to display a message on wrong file type during import
- Add the
File
facet to the document schemas - Update the
nuxeo-[document_type]-view-layout
and replace as you need:nuxeo-picture-formats
withcustom-picture-formats.html
, if you want to add the ability to replacePicture
renditionsnuxeo-video-conversions
withcustom-video-conversions.html
, if you want to add the ability to replaceVideo
renditions
- Update
_acceptedBlob
function incustom-replace-blob-button
to add/remove filter onmime-type
orfile extension
- Update
_upload
function incustom-dropzone
to add/remove filter onmime-type
orfile extension
(according tocustom-replace-blob-button
) and to update the error message (if needed)
Replacing renditions in this way presents limits:
- Document preview can be misleading:
Picture
document preview is theFullHD
renditionVideo
document preview is the1st element
in the rendition list- Modifying one of those rendition will lead to a state where preview is not the main content. It can be corrected by updating
computeImageSource
andcomputeVideoSources
functions innuxeo-document-preview
- Document thumbnail can be misleading
Picture
thumbnail is theSmall size
rendition- Modifying this rendition will lead to a state where thumbnail is not the main content. It can be corrected by updating the
_thumbnail
function innuxeo-document-thumbnail