# Crop image doesnt work

**URL:** <https://forum.getkirby.com/t/crop-image-doesnt-work/18627>\
**Category:** Questions\
**Tags:** v3\
**Created:** [June 26, 2020, 11:50am UTC](https://forum.getkirby.com/t/crop-image-doesnt-work/18627 "2020-06-26T11:50:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![QuentinJuhel](https://avatars.discourse-cdn.com/v4/letter/q/a587f6/32.png) [@QuentinJuhel](https://forum.getkirby.com/u/QuentinJuhel)\
**Post date:** [June 26, 2020, 11:50am UTC](https://forum.getkirby.com/t/crop-image-doesnt-work/18627/1 "2020-06-26T11:50:50Z")

</div>

Hi,

I’m working on a website based on the kirby theme “One”.  
It’s using `crop()` to crop images on the home and projects template, but it’s not working at all.

there is the source code :

```
<?php if($project->cover()->isNotEmpty()): $thumb = $project->cover()->toFile()->crop(600, 400);?>
  <img class="img-responsive" src="<?= $thumb->url() ?>" alt="" />
<?php endif ?> spaces 

```

But it’s not working att all. My images are not cropped.

I looked at the media folder and it’s appear there is no image files corresponding.

 ![Capture d’écran de 2020-06-26 13-47-48](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/3/3acd7d494c2127408eeda12e44abba11f8cf4ffb.png)

Maybe I’ve to manage my thumb in the config file, but it’s seems weird that the default config of Kirby doesn’t work.

Thank’s a lot

---

<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:** [June 26, 2020, 12:34pm UTC](https://forum.getkirby.com/t/crop-image-doesnt-work/18627/2 "2020-06-26T12:34:39Z")

</div>

> [@QuentinJuhel](#):
>
> `$thumb = $project->cover()->toFile()->crop(600, 400);`

The first thing would be to check if the image object exists before you call the crop method:

```auto
<?php if ($file = $project->cover()->toFile()) :
  $thumb = $file->crop(600, 400); ?>
  <img class="img-responsive" src="<?= $thumb->url() ?>" alt="" />
<?php endif ?>

```

Testing if `cover` is empty is not necessary then.

However, there seems to be another problem, because the jobs are created but not the thumbs themselves…

---

<div class="post-metadata">

**Author:** ![QuentinJuhel](https://avatars.discourse-cdn.com/v4/letter/q/a587f6/32.png) [@QuentinJuhel](https://forum.getkirby.com/u/QuentinJuhel)\
**Post date:** [June 26, 2020, 12:56pm UTC](https://forum.getkirby.com/t/crop-image-doesnt-work/18627/3 "2020-06-26T12:56:29Z")

</div>

Yes it’s weird, when I add a new project in the back office and save jobs are created but ther is no image in the media folder.

Image are created when I recharge the page, not thumbs, only the image source…

---

<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:** [June 26, 2020, 1:18pm UTC](https://forum.getkirby.com/t/crop-image-doesnt-work/18627/4 "2020-06-26T13:18:43Z")

</div>

Are you using the standard gd library or imagemagick in config? If you haven’t set a config option, then gd is the default, so make sure gd is present and enabled (check phpinfo()).

What web server are you using? Is this locally or on a remote server?

---

<div class="post-metadata">

**Author:** ![QuentinJuhel](https://avatars.discourse-cdn.com/v4/letter/q/a587f6/32.png) [@QuentinJuhel](https://forum.getkirby.com/u/QuentinJuhel)\
**Post date:** [June 26, 2020, 1:36pm UTC](https://forum.getkirby.com/t/crop-image-doesnt-work/18627/5 "2020-06-26T13:36:59Z")

</div>

Okay, I understand where is my problem.

I’ve some troubles with my php and Server installation.  
I’ve reinstall all the missing library and it’s working well now !
