Expand my Community achievements bar.

SOLVED

Bulk Generate page Thumbnails

Avatar

Level 4

Hi @All,
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
 

1 Accepted Solution

Avatar

Correct answer by
Level 4

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.

View solution in original post

6 Replies

Avatar

Level 4

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

Avatar

Level 4

Template thumbnail is already there i want to generate different thumbnails for all page.  

Avatar

Community Advisor

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

Avatar

Correct answer by
Level 4

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.