wCMF 4.1
Guides
Getting started
Architecture
Model
Persistence
Presentation
Configuration
Security
I18n & l10n
Tests
Versions
4.1.x
4.0.x
API
Classes
Hierarchy
Code
Support
home
travis
build
iherwig
wcmf
src
wcmf
application
views
plugins
modifier.width.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 width of the given image in pixels
14
*
15
* Example:
16
* @code
17
* {if $image|width > 1024}
18
* ...handle big image...
19
* {else}
20
* ...
21
* {/if}
22
* @endcode
23
*
24
* @param $image The image file
25
* @param $halfsize Boolean whether the width should be divided by two for retina displays (optional, default: __false__)
26
* @return Integer
27
*/
28
function
smarty_modifier_width($image, $halfsize=
false
) {
29
$size = getimagesize($image);
30
return
$halfsize ? intval($size[0]/2) : $size[0];
31
}
32
?>