modifier.height.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 height of the given image in pixels
14  *
15  * Example:
16  * @code
17  * {if $image|height > 768}
18  * ...handle big image...
19  * {else}
20  * ...
21  * {/if}
22  * @endcode
23  *
24  * @param $image The image file
25  * @param $halfsize Boolean whether the height should be divided by two for retina displays (optional, default: __false__)
26  * @return Integer
27  */
28 function smarty_modifier_height($image, $halfsize=false) {
29  $size = getimagesize($image);
30  return $halfsize ? intval($size[1]/2) : $size[1];
31 }
32 ?>