aboutsummaryrefslogtreecommitdiff
path: root/views/default/icon/default.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2013-03-10 08:41:55 -0700
committerCash Costello <cash.costello@gmail.com>2013-03-10 08:41:55 -0700
commit1fe6a8ce3120dc063a536c0ea41cfc798432d02f (patch)
treeaac40e7b6d4046867061e53966479e2d591189ae /views/default/icon/default.php
parent3736c93fb6e3910a592b037d961367180edd542e (diff)
parentd07700e172c37c7af64ba1be5032330ba9766cb0 (diff)
downloadelgg-1fe6a8ce3120dc063a536c0ea41cfc798432d02f.tar.gz
elgg-1fe6a8ce3120dc063a536c0ea41cfc798432d02f.tar.bz2
Merge pull request #5204 from cash/bug_5058
Fixes #5058 not forcing a size on an image
Diffstat (limited to 'views/default/icon/default.php')
-rw-r--r--views/default/icon/default.php30
1 files changed, 24 insertions, 6 deletions
diff --git a/views/default/icon/default.php b/views/default/icon/default.php
index 087c7eae9..7f13a1189 100644
--- a/views/default/icon/default.php
+++ b/views/default/icon/default.php
@@ -37,13 +37,31 @@ if (isset($vars['href'])) {
$icon_sizes = elgg_get_config('icon_sizes');
$size = $vars['size'];
-$img = elgg_view('output/img', array(
+if (!isset($vars['width'])) {
+ $vars['width'] = $size != 'master' ? $icon_sizes[$size]['w'] : null;
+}
+if (!isset($vars['height'])) {
+ $vars['height'] = $size != 'master' ? $icon_sizes[$size]['h'] : null;
+}
+
+$img_params = array(
'src' => $entity->getIconURL($vars['size']),
- 'alt' => $title,
- 'class' => $class,
- 'width' => $size != 'master' ? $icon_sizes[$size]['w'] : NULL,
- 'height' => $size != 'master' ? $icon_sizes[$size]['h'] : NULL,
-));
+ 'alt' => $title,
+);
+
+if (!empty($class)) {
+ $img_params['class'] = $class;
+}
+
+if (!empty($vars['width'])) {
+ $img_params['width'] = $vars['width'];
+}
+
+if (!empty($vars['height'])) {
+ $img_params['height'] = $vars['height'];
+}
+
+$img = elgg_view('output/img', $img_params);
if ($url) {
$params = array(