modifier.ratio.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2020 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
11 
12 /**
13  * Get the aspect ratio of the given image
14  *
15  * Example:
16  * @code
17  * {if $image|ratio < 1.78}
18  * ...aspect ratio of image is smaller than 16:9, e.g 4:3...
19  * {else}
20  * ...
21  * {/if}
22  * @endcode
23  *
24  * @param $image The image file
25  * @return Float
26  */
27 function smarty_modifier_ratio($image) {
28  $size = getimagesize($image);
29  return $size[0]/$size[1];
30 }
31 ?>