# thumbs

Set default configuration for thumbs

****

****

## Presets

You can define option presets for thumbs:

```php "/site/config/config.php"
return [
    'thumbs' => [
        'presets' => [
            'default' => ['width' => 1024, 'quality' => 80],
            'blurred' => ['blur' => true]
        ]
    ]
];
```

To be used with the `$file->thumb()` method. <a href="https://getkirby.com/docs/reference/objects/cms/file/thumb">Learn more &rsaquo;</a>

## Srcsets

```php "/site/config/config.php"
return [
  'thumbs' => [
    'srcsets' => [
      'default' => [
        '800w' => ['width' => 800, 'quality' => 80],
        '1024w' => ['width' => 1024, 'quality' => 80],
        '1440w' => ['width' => 1440, 'quality' => 80],
        '2048w' => ['width' => 2048, 'quality' => 80]
      ]
  ]
  ]
];
```

To be used with the `$file->srcset()` method. <a href="https://getkirby.com/docs/reference/objects/cms/file/srcset">Learn more &rsaquo;</a>

## Auto-orient

Automatically rotate images based on their exif orientation data.

```php
return [
  'thumbs' => [
    'autoOrient' => true
  ]
];
```

## Quality

The default compression quality for all thumbnails

```php
return [
  'thumbs' => [
    'quality' => 80
  ]
];
```

Depending on your thumbnail driver, this is supported for JPG, WEBP and AVIF images (`gd` driver) or JPEG, PNG, HEIC, AVIF and WebP images (`im` driver).

## Format

You can set a default format for thumbs in your config file to convert all images unless you override the format option in the thumb method.

```php "/site/config/config.php"
<?php

return [
  'thumbs' => [
    'format' => 'webp'
  ]
];
```

This is only recommended if you really find yourself converting 90% of your files to that format anyway. Otherwise you will need to override the default quite a lot.

## Thumbs driver

Kirby comes with drivers for GD Lib (`gd`) and Imagick (`imagick`, since v5.1.0), which can be used out of the box. The default thumbs driver is `gd`.

You can also define your own custom thumbs drivers.

```php
return [
  'thumbs' => [
    'driver' => 'imagick'
  ]
];
```

<warning>
The old ImageMagick (`im`) driver has been deprecated and will be removed in a future major release. Use the `imagick` driver instead.
</warning>

<since v="5.1.0">
### Additional options for the Imagick driver

#### `interlace`

JPEGs can be set to interlace mode with this option

```php
return [
  'thumbs' => [
    'driver'    => 'imagick',
    'interlace' => true
  ]
];
```

#### `profiles`

Which image profiles to preserve when resizing the thumb. By default, the `icc` and `icm` profiles are preserved.

```php
return [
  'thumbs' => [
    'driver'   => 'imagick',
    'profiles' => ['icc']
  ]
];
```

#### `threads`

If you are converting a lot of big images with Imagick it can get slow.

Use this option to configure the threads Imagick can use to benefit from capable hardware. (default is 1)

```php
return [
  'thumbs' => [
    'driver' => 'imagick',
    'threads' => 2
  ]
];
```
</since>

### Additional options for the ImageMagick driver

All of the above options for the Imagick driver as well as:

#### `bin`

If the ImageMagick convert binary is not correctly linked, you can set the absolute path to the binary here.

```php
return [
  'thumbs' => [
    'driver' => 'im',
    'bin'    => 'convert'
  ]
];
```