Bulk Generate page Thumbnails | Community
Skip to main content
June 1, 2022
Solved

Bulk Generate page Thumbnails

  • June 1, 2022
  • 3 replies
  • 1431 views

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.
Best answer by BipinCh1

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.

3 replies

June 1, 2022

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

June 1, 2022

No i want to generate different Thumbnails for all pages.

Himanshu_Jain
Community Advisor
Community Advisor
June 1, 2022
arunpatidar
Community Advisor
Community Advisor
June 1, 2022

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);
        });
    }

 

Arun Patidar
BipinCh1Accepted solution
June 1, 2022

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.