Jump to content

Page method to create Image variations


thomas
 Share

Recommended Posts

Hi everyone,

I have a site which uses a bunch of images per page and now I am about to change the template. Problem is that the first call of those pages takes forever since it creates all image variants. Is there a method to iterate over all those pages and create the images or would I have to create a hook for that? Problem is that the actual size of those images is calculated individually in the template so I would either have to duplicate the logic in this hook or parse the templates which I wouldn't know how ...

Anyone got an idea?

Thanks!

Link to comment
Share on other sites

I haven't tried (and so could easily be wrong!), but I think the following would work:

foreach ($pages->find("template=template_name") as $page) {
    ob_start();
    $page->render();
    ob_end_clean();
}

The output buffering is to stop the pages rendering in the browser.

It'd probably be easiest to put the code in a template file.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...