<p>Set <a href="http://buildwithcraft.com/docs/config-settings#generateTransformsBeforePageLoad" rel="noreferrer">generateTransformsBeforePageLoad</a> in your <code>config/general.php</code> file.</p>

<pre><code>'generateTransformsBeforePageLoad' =&gt; true,
</code></pre>

<blockquote>
  <p>Configures Craft to generate new image transforms right when getUrl() is called, rather than when the browser first requests the image.</p>
</blockquote>

CC BY-SA 3.0
2015-03-18T08:48:04.263Z
Oh, I should have seen that setting earlier! Thanks Marion for the answer; this is perfect.
Johan Douma
CC BY-SA 3.0
2015-03-18T08:25:02.330Z
2015-03-18T08:25:02.330Z
Marion Newlevant
<p>This issue is very similar to the following issue, but this goes a little bit further. <a href="https://craftcms.stackexchange.com/questions/735/cache-tag-won-t-cache-in-a-template">Cache tag won’t cache in a template</a> </p>

<p>I have a page which is made up of hundreds of lazy loaded images similarly to this: </p>

<pre><code> &lt;img data-original="{{ image.getUrl(transform) }}" src="/img/placeholder.png" alt="" /&gt;
</code></pre>

<p>The page takes anywhere between 2 and 5 seconds to load, and yet the server isn't under powered in any way.</p>

<p>The majority of the images on the page aren't transformed within a few page loads. It's quite possible that there are images that no one will ever look at, therefore will never be transformed... Craft will hold off on caching until all the images are transformed; which might never happen.</p>

<p>I could duplicate the template, and turn off lazy loading, and get my client to load that page every time they make changes, but I would prefer not having to ask my client to anything like that. </p>

<p>Apart from loading stuff via ajax when needed, does anyone know of an easy way to get all the images transformed or to get caching working so that it doesn't require all assets to be transformed?</p>

<assets><cache><image-transforms>
Cache/ColdCache & checking for ungenerated image transforms
# Cache/ColdCache & checking for ungenerated image transforms

(Asked by: username_0 on 2015-03-18)

This issue is very similar to the following issue, but this goes a little bit further. Cache tag won’t cache in a template 
I have a page which is made up of hundreds of lazy loaded images similarly to this: 
 

The page takes anywhere between 2 and 5 seconds to load, and yet the server isn't under powered in any way.
The majority of the images on the page aren't transformed within a few page loads. It's quite possible that there are images that no one will ever look at, therefore will never be transformed... Craft will hold off on caching until all the images are transformed; which might never happen.
I could duplicate the template, and turn off lazy loading, and get my client to load that page every time they make changes, but I would prefer not having to ask my client to anything like that. 
Apart from loading stuff via ajax when needed, does anyone know of an easy way to get all the images transformed or to get caching working so that it doesn't require all assets to be transformed?

**Tags:** assets, cache, image-transforms


---

## 1 answers

### Answer by username_1 on 2015-03-18. Score: 7 | Accepted answer

Set generateTransformsBeforePageLoad in your config/general.php file.
'generateTransformsBeforePageLoad' => true,


Configures Craft to generate new image transforms right when getUrl() is called, rather than when the browser first requests the image.

> **Comments:**
> **username_0**: Oh, I should have seen that setting earlier! Thanks Marion for the answer; this is perfect.  

---

