# Using crop with srcset

**URL:** <https://forum.getkirby.com/t/using-crop-with-srcset/28192>\
**Category:** Questions\
**Created:** [March 24, 2023, 11:17am UTC](https://forum.getkirby.com/t/using-crop-with-srcset/28192 "2023-03-24T11:17:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dilby](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dilby/32/3221_2.png) [@dilby](https://forum.getkirby.com/u/dilby)\
**Post date:** [March 24, 2023, 11:18am UTC](https://forum.getkirby.com/t/using-crop-with-srcset/28192/1 "2023-03-24T11:18:00Z")

</div>

Hi all - I’m having trouble cropping images that use kirby’s basic srcset feature (below copied from docs which is my test code)

```auto
<?php if ($image = $page->image()): ?>
    <img
        alt="<?= $image->alt()?>"
        class="lazyload"
        data-sizes="auto"
        data-src="<?= $image->resize(1280)->url() ?>"
        data-srcset="<?= $image->srcset([320, 640, 960, 1280, 1600, 1920]) ?>"
        height="<?= $image->height() ?>"
        width="<?= $image->width() ?>"
    >
<?php endif ?>

```

Can anyone point me in the direction of some docs for this as I can’t find anything. Thanks!

---

<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 24, 2023, 11:41am UTC](https://forum.getkirby.com/t/using-crop-with-srcset/28192/2 "2023-03-24T11:41:04Z")

</div>

> **[$file-\>srcset()](https://getkirby.com/docs/reference/objects/cms/file/srcset)**
>
> Create a srcset definition for the given sizes Sizes can be defined as a simple array. They can also be set up in the config with the thumbs.srcsets option.

---

<div class="post-metadata">

**Author:** ![dilby](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dilby/32/3221_2.png) [@dilby](https://forum.getkirby.com/u/dilby)\
**Post date:** [March 24, 2023, 12:02pm UTC](https://forum.getkirby.com/t/using-crop-with-srcset/28192/3 "2023-03-24T12:02:11Z")

</div>

Thanks for the reply but this is a broken link and the domain looks like a staging server or the like?

---

<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 24, 2023, 12:04pm UTC](https://forum.getkirby.com/t/using-crop-with-srcset/28192/4 "2023-03-24T12:04:08Z")

</div>

Sorry, was in my local env

---

<div class="post-metadata">

**Author:** ![dilby](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dilby/32/3221_2.png) [@dilby](https://forum.getkirby.com/u/dilby)\
**Post date:** [March 24, 2023, 1:41pm UTC](https://forum.getkirby.com/t/using-crop-with-srcset/28192/5 "2023-03-24T13:41:37Z")

</div>

Thanks. That’s helped me find the actual issue and it turns out it’s because I have an animated gif, and altough i read that the imagekick driver worked for animated gifs it doesn’t seem to for me; switched to webp and working fine. Would be great to include this in the docs at some point 🙂
