# Crop() does show correct image-url, but the image didn't crop

**URL:** <https://forum.getkirby.com/t/crop-does-show-correct-image-url-but-the-image-didnt-crop/26288>\
**Category:** Questions\
**Tags:** v3\
**Created:** [August 24, 2022, 3:11pm UTC](https://forum.getkirby.com/t/crop-does-show-correct-image-url-but-the-image-didnt-crop/26288 "2022-08-24T15:11:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ovaiu](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ovaiu/32/218_2.png) [@ovaiu](https://forum.getkirby.com/u/ovaiu)\
**Post date:** [August 24, 2022, 3:11pm UTC](https://forum.getkirby.com/t/crop-does-show-correct-image-url-but-the-image-didnt-crop/26288/1 "2022-08-24T15:11:08Z")

</div>

I implemented a crop() function.

```auto
 <?php if ($image = $angebot->image()):
          ?>
            <img alt="<?= $image->alttext() ?>" src="<?= $image->crop(200, 100, 'center')->url() ?>">
          <?php endif ?>

```

Am I right when I suggest, that these function crops my image to the wanted ratio? The code seems to work because I found a new image url pointing to the media directory. There is a new directory inside with a cryptic number code but no image inside these directory. As you can see in the screenshot, the image is still portrait-modus although the the image-name changed due to the crop-function. Any ideas?

 ![Bildschirmfoto 2022-08-24 um 16.55.29](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/f/fc478e919c129e0842c1039608531dd9ff61c4fa.png)  
 ![Bildschirmfoto 2022-08-24 um 17.10.02](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/3/333d8c8e04aa0c589400543180fb7afbd4b16a5d.png)

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [August 24, 2022, 3:16pm UTC](https://forum.getkirby.com/t/crop-does-show-correct-image-url-but-the-image-didnt-crop/26288/2 "2022-08-24T15:16:55Z")

</div>

Just a hunch but it looks like its just passing through without getting manipulated. Which image drver are you using in the config? Do you actually have it installed on your system. You can install easily via Homebrew.

If you have set it to use IM but dont actually have it installed, the image with just pass through but gets the filename it would have got had the crop actually worked.

> **[thumbs](https://getkirby.com/docs/reference/system/options/thumbs#thumbs-driver)**
>
> Set default configuration for thumbs

---

<div class="post-metadata">

**Author:** ![ovaiu](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ovaiu/32/218_2.png) [@ovaiu](https://forum.getkirby.com/u/ovaiu)\
**Post date:** [August 24, 2022, 3:37pm UTC](https://forum.getkirby.com/t/crop-does-show-correct-image-url-but-the-image-didnt-crop/26288/3 "2022-08-24T15:37:31Z")

</div>

thanks - didn’t know that I had to install an image driver … I set up the config like in yout link – but that did not have any effect so I think I have to install these image driver … is there any docu for this? I coudn’t find something in the cropping image docu …

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [August 24, 2022, 3:49pm UTC](https://forum.getkirby.com/t/crop-does-show-correct-image-url-but-the-image-didnt-crop/26288/4 "2022-08-24T15:49:41Z")

</div>

Would recommend IM over GD. Assuming you have Homebrew installed (instructions here [https://brew.sh/](https://brew.sh/))

Its just a matter of running `brew install imagemagick` and your all set.

---

<div class="post-metadata">

**Author:** ![ovaiu](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ovaiu/32/218_2.png) [@ovaiu](https://forum.getkirby.com/u/ovaiu)\
**Post date:** [August 24, 2022, 4:00pm UTC](https://forum.getkirby.com/t/crop-does-show-correct-image-url-but-the-image-didnt-crop/26288/5 "2022-08-24T16:00:33Z")

</div>

thanks again 😉 seems that imagemagic is already installed … hmm

 ![Bildschirmfoto 2022-08-24 um 17.59.46](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/c/c1f44f95331a1459f63006e85ee13ccb33def268.png)

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [August 24, 2022, 4:06pm UTC](https://forum.getkirby.com/t/crop-does-show-correct-image-url-but-the-image-didnt-crop/26288/6 "2022-08-24T16:06:13Z")

</div>

Thats just the Kirby code that uses ImageMagik. Its not imagemagic itself. Its useless without ImageMagick being installed on the server or local machine.

If you run the following on the command line…

```auto
convert -version

```

if IM is installed you will see something like:

```auto
Version: ImageMagick 7.1.0-30 Q16-HDRI arm 19924 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(5.0) 
Delegates (built-in): bzlib fontconfig freetype gslib heic jng jp2 jpeg lcms lqr ltdl lzma openexr png ps raw tiff webp xml zlib
Compiler: gcc (4.2)

```

If it isnt it will say something like command not found. In which case you need install it via home brew.

---

<div class="post-metadata">

**Author:** ![ovaiu](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ovaiu/32/218_2.png) [@ovaiu](https://forum.getkirby.com/u/ovaiu)\
**Post date:** [August 24, 2022, 4:32pm UTC](https://forum.getkirby.com/t/crop-does-show-correct-image-url-but-the-image-didnt-crop/26288/7 "2022-08-24T16:32:11Z")

</div>

ok thank you – that was the missing part! I installed imagemagick and now it works. It’s a bit irritating that it is not mentioned anywhere in the docs that you need to install an imagedriver on your system first. Think I also have to install it on the live server as well?

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [August 24, 2022, 4:47pm UTC](https://forum.getkirby.com/t/crop-does-show-correct-image-url-but-the-image-didnt-crop/26288/8 "2022-08-24T16:47:12Z")

</div>

99.9% of webservers have GD installed by default and IM is optional but usually available. The issue here is that you are running the site locally which is a different ball game. MacOs Used to have GD preloaded, but i think they dropped it from Big Sur onwards (not certain on that). If you were running a LInux distro you would probably have GD available out the box. Windows not so much on with GD or IM.

Its not really a thing for the docs as its general server / os setup. If your running Plesk or cPanel on your actual server you might need to tick a box in the control panel to make IM available, but i doubt you would actually need to install it. GD is often the default.

---

<div class="post-metadata">

**Author:** ![jwssnr](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jwssnr/32/11727_2.png) [@jwssnr](https://forum.getkirby.com/u/jwssnr)\
**Post date:** [March 23, 2023, 11:54am UTC](https://forum.getkirby.com/t/crop-does-show-correct-image-url-but-the-image-didnt-crop/26288/9 "2023-03-23T11:54:19Z")

</div>

I had the same issue. But it was not `imagemagick` itself but this plugin which caused this problem on my local enviroment.

> **[GitHub - bnomei/kirby3-thumb-imageoptim: Kirby 3 CMS Thumb Component to...](https://github.com/bnomei/kirby3-thumb-imageoptim)**
>
> Kirby 3 CMS Thumb Component to optimize images using ImageOptim Api - GitHub - bnomei/kirby3-thumb-imageoptim: Kirby 3 CMS Thumb Component to optimize images using ImageOptim Api
