<p>When <code>'generateTransformsBeforePageLoad' =&gt; true</code> is set, is it taking a long time to load because of the sheer number of images you have or is it only on the first request when all of the transforms are being generated?</p>

<p>After they are generated, they are quickly served directly by Apache (or whatever your webserver is) and Craft doesn't get involved.</p>

<p>If it's because of the sheer number of images you have, then you'll probably want to look at a front-end method of lazy loading the images as they are needed.</p>

CC BY-SA 3.0
2014-08-05T03:11:12.053Z
2014-08-05T03:11:12.053Z
Brad Bell
<p>I'm using a gallery where when an image is clicked it opens a larger version in a modal.</p>

<pre><code>&lt;li&gt;&lt;a href="{{ varGalleryImages.getUrl('galleryLarge') }}"&gt;&lt;img src="{{ varGalleryImages.getUrl('galleryThumb') }}" alt=""&gt;&lt;/a&gt;&lt;/li&gt;
</code></pre>

<p>Initially the larger 'galleryLarge' images wouldn't load because the transform hadn't been created. After some digging around on here I found that adding 'generateTransformsBeforePageLoad' => true, to craft/config/general.php would create the transforms (all of them) before the page loads.  This worked a treat and now my modal works as expected!</p>

<p>Problem:  The page now takes forever to load.  I stopped this issue by removing the line from general.php but now of course, any new images added by the client won't get transformed.</p>

<p>Any ideas around this issue would be great.</p>

<p>Many thanks</p>

<p>Martin</p>

<image-transforms><modal>
Image transforms and modal gallery
# Image transforms and modal gallery

(Asked by: username_0 on 2014-08-04)

I'm using a gallery where when an image is clicked it opens a larger version in a modal.


Initially the larger 'galleryLarge' images wouldn't load because the transform hadn't been created. After some digging around on here I found that adding 'generateTransformsBeforePageLoad' => true, to craft/config/general.php would create the transforms (all of them) before the page loads.  This worked a treat and now my modal works as expected!
Problem:  The page now takes forever to load.  I stopped this issue by removing the line from general.php but now of course, any new images added by the client won't get transformed.
Any ideas around this issue would be great.
Many thanks
username_0

**Tags:** image-transforms, modal


---

## 1 answers

### Answer by username_1 on 2014-08-05. Score: 1

When `'generateTransformsBeforePageLoad' => true` is set, is it taking a long time to load because of the sheer number of images you have or is it only on the first request when all of the transforms are being generated?

After they are generated, they are quickly served directly by Apache (or whatever your webserver is) and Craft doesn't get involved.

If it's because of the sheer number of images you have, then you'll probably want to look at a front-end method of lazy loading the images as they are needed.


---

