# Toolkit thumb: “Unable to save image”

**URL:** <https://forum.getkirby.com/t/toolkit-thumb-unable-to-save-image/4527>\
**Category:** Questions\
**Tags:** v2\
**Created:** [June 27, 2016, 2:39pm UTC](https://forum.getkirby.com/t/toolkit-thumb-unable-to-save-image/4527 "2016-06-27T14:39:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![julieng](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/julieng/32/6770_2.png) [@julieng](https://forum.getkirby.com/u/julieng)\
**Post date:** [June 27, 2016, 2:39pm UTC](https://forum.getkirby.com/t/toolkit-thumb-unable-to-save-image/4527/1 "2016-06-27T14:39:35Z")

</div>

Hi everyone,

I encounter issues with the Toolkit thumb function in a custom Kirby-tag. As I mention it in the post title, the function seems unable to save images when panel and templates can.

I don’t understand if I don’t use the function correctly or if it’s a server configuration problem. But from a server configuration point of view, it seems OK, because the thumb folder is not empty.

My function is

```auto
$_thumb = new Thumb($file->root(), array(
  'driver' => 'gd',
  'width' => $tag->attr('width') ?: c::get('kirbytext.image.width', null),
  'height' => $tag->attr('height') ?: c::get('kirbytext.image.height', null),
));

```

This function does not create new files in the thumb folder.  
I tried with and without `gd` driver (`im` by default, `kirby/toolkit/lib/thumb.php` line 24)  
With `im`, I cannot output anything, with `gd`, I can see an error if I add `echo $e;` on line 363 of `kirby/toolkit/lib/thumb.php` (I did not manage how to use `thumb::error()`).

Any help appreciates.

Thanks,

j.

---

<div class="post-metadata">

**Author:** ![julieng](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/julieng/32/6770_2.png) [@julieng](https://forum.getkirby.com/u/julieng)\
**Post date:** [June 27, 2016, 3:46pm UTC](https://forum.getkirby.com/t/toolkit-thumb-unable-to-save-image/4527/2 "2016-06-27T15:46:36Z")

</div>

OK,

I just had to set a `root` option because default is set to `/thumbs` (and it’s from the root of your server).

```auto
$_thumb = new Thumb($file, array(
  'driver' => 'gd',
  'root' => kirby()->roots()->thumbs(),
  'width' => $tag->attr('width') ?: c::get('kirbytext.image.width',null),
  'height' => $tag->attr('height') ?: c::get('kirbytext.image.height',null),
));

```

---

<div class="post-metadata">

**Author:** ![julieng](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/julieng/32/6770_2.png) [@julieng](https://forum.getkirby.com/u/julieng)\
**Post date:** [June 27, 2016, 5:19pm UTC](https://forum.getkirby.com/t/toolkit-thumb-unable-to-save-image/4527/4 "2016-06-27T17:19:08Z")

</div>

Hum, a strange thing appends.

My function is in Kirby tag.

If I use it like this, the created thumbnails are named and organized like the old fashion flat-hashed way.  
Don’t change anything, but use a `$anotherImage->resize($width)` somewhere  
before in the template, and the Kirby tag thumbnails are properly  
renamed and organized like 2.3. do.

Why? Is the `resize()` method defines some global parameters I missed?

Thanks,

j.

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [June 27, 2016, 6:18pm UTC](https://forum.getkirby.com/t/toolkit-thumb-unable-to-save-image/4527/5 "2016-06-27T18:18:32Z")

</div>

With Kirby 2.3, the CMS-specific thumb code has been moved from the Toolkit to a new `thumb` component. The `Thumb` class is now more low-level.

You can use the CMS-specific code if you use the `thumb()` helper instead of `new Thumb`.

---

<div class="post-metadata">

**Author:** ![julieng](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/julieng/32/6770_2.png) [@julieng](https://forum.getkirby.com/u/julieng)\
**Post date:** [June 27, 2016, 8:18pm UTC](https://forum.getkirby.com/t/toolkit-thumb-unable-to-save-image/4527/6 "2016-06-27T20:18:41Z")

</div>

Thank you @lukasbestle! It works like a charm!

You can find its application here : [https://github.com/julien-gargot/kirby-plugin-auto-thumbnail](https://github.com/julien-gargot/kirby-plugin-auto-thumbnail).

Cheers 🍺

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 4:57pm UTC](https://forum.getkirby.com/t/toolkit-thumb-unable-to-save-image/4527/7 "2025-02-06T16:57:42Z")

</div>


