Bulk Generate page Thumbnails | Community
Skip to main content
Level 4
Jun 1, 2022 8:04 AM UTC
Solved

Bulk Generate page Thumbnails

Hi @1905403,
we have a  requirement . we have approx 15,000 pages and for all the pages i need to generate thumbnails
(page properties -> thumbnails -> generate -> save & close)
Is there is any automated way to do this ?

Thanks and regards
Saurabh Kumar
 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
BipinCh1Accepted solution
Level 3
Jun 1, 2022 12:12 PM UTC

Hi @lone_ranger  Currently Adobe uses PageThumbnail.js(/libs/cq/gui/components/common/wcm/clientlibs/wcm/js/pagethumbnail.js) for the thumbnail generation. Please check the method function generate() that is used for thumbnail generation.

You can use this function to generate the page thumbnails and loop it for all the pages. Please note that this generate only file.sftmp on the jcr that is used to hold temporary assets data in JCR.

6 replies

BipinCh1Accepted solution
Level 3
Jun 1, 2022 12:12 PM UTC

Hi @lone_ranger  Currently Adobe uses PageThumbnail.js(/libs/cq/gui/components/common/wcm/clientlibs/wcm/js/pagethumbnail.js) for the thumbnail generation. Please check the method function generate() that is used for thumbnail generation.

You can use this function to generate the page thumbnails and loop it for all the pages. Please note that this generate only file.sftmp on the jcr that is used to hold temporary assets data in JCR.

Translate
arunpatidar
New Participant
Jun 1, 2022 11:21 AM UTC

Hi,

Not sure if it can be done from backend as there is no API(I am not aware of any)

But the logic is at client side - http://localhost:4502/libs/cq/gui/components/common/wcm/clientlibs/wcm.js

 

function generate(component) {
        var activator = component.find(".cq-wcm-pagethumbnail-activator").prop("disabled", true);
        wait(component);

        var path = component.data("cqWcmPagethumbnailPath");
        var isTemplate = component.data("isTemplate") || false;
        var dest = isTemplate ? "thumbnail.png.sftmp" : "file.sftmp";

        var pgen = new CQ.Siteadmin.PagePreview();
        pgen.generatePreview(path, dest, isTemplate, function(data) {
            // use attr() instead of prop() for action, so that no domain is appended
            if(isTemplate) {
                setValue(component, "./thumbnail.png@MoveFrom", component.closest("form").attr("action") + "/" + dest);
            } else {
                setValue(component, "./image/file@MoveFrom", component.closest("form").attr("action") + "/image/" + dest);
            }
            clearWait(component, data);
            activator.prop("disabled", false);
        });
    }

 

Translate
Arun Patidar
Level 4
Jun 1, 2022 8:33 AM UTC

Do you want to apply some specific image as thumbnail ? If yes, you can write custom script for this.

Translate
Level 4
Jun 1, 2022 8:52 AM UTC

No i want to generate different Thumbnails for all pages.

Translate