Liferay DXP automatically generates thumbnails for images in Documents and Media. Once you deploy the Adaptive Media app, however, Liferay DXP doesn’t display thumbnails until you migrate them to Adaptive Media. This article walks you through this migration process.
You’ll get started by creating image resolutions for the thumbnails in Adaptive Media.
To migrate the existing Documents and Media thumbnails, you must add new image resolutions in Adaptive Media that have maximum height and maximum width values that match the values specified in the following portal properties:
To create the new Image Resolutions, follow the instructions found in the Adding Image Resolutions section of the Adaptive Media user guide.
Now you’re ready to to create the Adaptive Media images.
Once the required image resolutions exist, you can convert the Documents and Media thumbnails to Adaptive Media images. As mentioned in the Adaptive Media installation guide, the module Liferay Adaptive Media Document Library Thumbnails (which is included in the Adaptive Media app) enables this functionality.
There are two different ways to migrate the Documents and Media thumbnails to Adaptive Media:
Adapt the images for the thumbnail image resolution: This scales the existing thumbnails to the values in the Adaptive Media image resolutions, which can take time depending on the number of images. We only recommend this approach when there isn’t a large number of thumbnails to process, or if you prefer to generate your images from scratch. This approach is covered in more detail in the Generating Missing Adapted Images section of the Adaptive Media user guide.
Execute a migrate process that reuses the existing thumbnails: This copies the existing thumbnails to Adaptive Media, which performs better because it avoids the computationally expensive scaling operation. The next section describes the steps to run this process.
The migration process is a set of Gogo console commands. You can learn more about using the Gogo console in the Felix Gogo Shell tutorial.
Follow these steps to migrate your thumbnails from the Gogo console:
thumbnails:checkcommand. For each instance, this lists how many thumbnails are pending migration.
thumbnails:migratecommand. This executes the migration process, which may take a while to finish depending on the number of images.
thumbnails:cleanUpcommand. This deletes all the original Documents and Media thumbnails and updates the count returned by
thumbnails:check. Therefore, you should only run
thumbnails:cleanUpafter running the migrate command and ensuring that the migration ran successfully and no images are pending migration.
Great! Now you know how to migrate your Documents and Media thumbnails to adapted images.