# Generate thumbnails before they are requested

**URL:** <https://forum.getkirby.com/t/generate-thumbnails-before-they-are-requested/17611>\
**Category:** Questions\
**Tags:** v3\
**Created:** [March 15, 2020, 11:21pm UTC](https://forum.getkirby.com/t/generate-thumbnails-before-they-are-requested/17611 "2020-03-15T23:21:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![max](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/max/32/129_2.png) [@max](https://forum.getkirby.com/u/max)\
**Post date:** [March 15, 2020, 11:21pm UTC](https://forum.getkirby.com/t/generate-thumbnails-before-they-are-requested/17611/1 "2020-03-15T23:21:50Z")

</div>

Is there is a way to generate thumbnails throughout the site without requesting them from the front end? I have a site with a lot of images using srcset, so visiting the front end page only generates the thumbnails for that breakpoint. If someone visits the site for a breakpoint that has not been generated, it’s going to be very slow.

I know I could use a hook to generate thumbnails when the image is uploaded to the panel, but I’m looking for a way to do it now that everything is already there. Thanks

---

<div class="post-metadata">

**Author:** ![thguenther](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/thguenther/32/16708_2.png) [@thguenther](https://forum.getkirby.com/u/thguenther)\
**Post date:** [March 15, 2020, 11:52pm UTC](https://forum.getkirby.com/t/generate-thumbnails-before-they-are-requested/17611/2 "2020-03-15T23:52:49Z")

</div>

This script by @lukaskleinschmidt generates all thumbnails on your site: [https://gist.github.com/lukaskleinschmidt/40014aad9884b449a2f183e53f147c3a](https://gist.github.com/lukaskleinschmidt/40014aad9884b449a2f183e53f147c3a)

---

<div class="post-metadata">

**Author:** ![max](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/max/32/129_2.png) [@max](https://forum.getkirby.com/u/max)\
**Post date:** [March 16, 2020, 3:12am UTC](https://forum.getkirby.com/t/generate-thumbnails-before-they-are-requested/17611/3 "2020-03-16T03:12:29Z")

</div>

Thank you @thguenther and @lukaskleinschmidt  
But how is this script meant to be used? It’s not clear to me from the gist.

Do you create three new folders in the project root?  
public/index.php  
bootstrap/kirby.php  
tools/thumbs.php

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [March 16, 2020, 9:22am UTC](https://forum.getkirby.com/t/generate-thumbnails-before-they-are-requested/17611/4 "2020-03-16T09:22:21Z")

</div>

Checkout this plugin: [https://github.com/bnomei/kirby3-janitor#custom-jobs](https://github.com/bnomei/kirby3-janitor#custom-jobs)

It has a job for pre-generating thumbs as well.

---

<div class="post-metadata">

**Author:** ![max](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/max/32/129_2.png) [@max](https://forum.getkirby.com/u/max)\
**Post date:** [March 16, 2020, 7:18pm UTC](https://forum.getkirby.com/t/generate-thumbnails-before-they-are-requested/17611/5 "2020-03-16T19:18:56Z")

</div>

The janitor plugin did the trick. Thank you @texnixe!
