# Image Block Cropping and Image Ratio

**URL:** <https://forum.getkirby.com/t/image-block-cropping-and-image-ratio/22284>\
**Category:** Questions\
**Tags:** v3\
**Created:** [May 12, 2021, 9:47am UTC](https://forum.getkirby.com/t/image-block-cropping-and-image-ratio/22284 "2021-05-12T09:47:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rapha](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/rapha/32/6376_2.png) [@rapha](https://forum.getkirby.com/u/rapha)\
**Post date:** [May 12, 2021, 9:47am UTC](https://forum.getkirby.com/t/image-block-cropping-and-image-ratio/22284/1 "2021-05-12T09:47:16Z")

</div>

Hey all

sorry about the maybe silly question but if i use the default image block and set cropping and ratio. There will be no effect in the frontend.

Is this right? I know i read about different stuff here but, what do you to get the images in right dimensions and crop out in the frontend? At the moment i just… do not see a best practice.

Thank you for your advices

---

<div class="post-metadata">

**Author:** ![pixelijn](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pixelijn](https://forum.getkirby.com/u/pixelijn)\
**Post date:** [May 12, 2021, 9:53am UTC](https://forum.getkirby.com/t/image-block-cropping-and-image-ratio/22284/2 "2021-05-12T09:53:31Z")

</div>

> [@rapha](#):
>
> There will be no effect in the frontend.

That’s right. The image snippet only sets a data-ratio attribute but doesn’t do any cropping, resizing etc.

You can overwrite this snippet for your use case.

---

<div class="post-metadata">

**Author:** ![rapha](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/rapha/32/6376_2.png) [@rapha](https://forum.getkirby.com/u/rapha)\
**Post date:** [May 12, 2021, 9:59am UTC](https://forum.getkirby.com/t/image-block-cropping-and-image-ratio/22284/3 "2021-05-12T09:59:11Z")

</div>

> [@pixelijn](#):
>
> You can overwrite this snippet for your use case.

Ok i know i can overwrite the snippet but how i do it best way… i am not sure about that.

Maybe i have to precise my question. What is the best way to get the right ratio dimensions in the frontend. 🙃

---

<div class="post-metadata">

**Author:** ![rapha](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/rapha/32/6376_2.png) [@rapha](https://forum.getkirby.com/u/rapha)\
**Post date:** [May 12, 2021, 12:40pm UTC](https://forum.getkirby.com/t/image-block-cropping-and-image-ratio/22284/4 "2021-05-12T12:40:48Z")

</div>

Ok… maybe i really do not understand the concept but for image ratio settings i need the ratio in % right?

Value from Kirby is like 16/9 and not 56.25% which i need for calculating. That makes for me the ratio settings useless because i need to calculate it anyway from the actual image width and height.

am i wrong?

---

<div class="post-metadata">

**Author:** ![rapha](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/rapha/32/6376_2.png) [@rapha](https://forum.getkirby.com/u/rapha)\
**Post date:** [May 12, 2021, 12:52pm UTC](https://forum.getkirby.com/t/image-block-cropping-and-image-ratio/22284/5 "2021-05-12T12:52:37Z")

</div>

Right i am wrong… it is not completely useless. Now i did:

```
<?php
$ratioCalc = $ratio->split('/');
$actualRatio = $ratioCalc[1] / $ratioCalc[0] * 100;
?>

```

this is giving me the right ratio in % what i need.
