' . elgg_echo('au_subgroups:subgroup') . ''; // $span = '' . ''; } if (isset($entity->name)) { $title = $entity->name; } else { $title = $entity->title; } $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8', false); $url = $entity->getURL(); if (isset($vars['href'])) { $url = $vars['href']; } $icon_sizes = elgg_get_config('icon_sizes'); $size = $vars['size']; // maintain aspect ratio $filehandler = new ElggFile(); $filehandler->owner_guid = $entity->owner_guid; $filehandler->setFilename("groups/" . $entity->guid . $size . ".jpg"); $location = elgg_get_plugins_path() . "groups/graphics/default{$size}.gif"; if ($filehandler->open("read")) { $location = $filehandler->getFilenameOnFilestore(); } $imginfo = getimagesize($location); if($imginfo){ $realratio = $imginfo[0]/$imginfo[1]; $img_height = $size != 'master' ? $icon_sizes[$size]['h'] : NULL; $img_width = $size != 'master' ? $icon_sizes[$size]['w'] : NULL; //set ratio greater than realratio by default in case $img_height = 0 $setratio = $realratio + 1; if(!empty($img_height)){ $setratio = $img_width/$img_height; } // set the largest dimension to "auto" if($realratio > $setratio || empty($img_height)){ // constrain the height $img_height = NULL; } elseif($realratio < $setratio || empty($img_width)){ $img_width = NULL; } } $img = '
'; $img .= elgg_view('output/img', array( 'src' => $entity->getIconURL($vars['size']), 'alt' => $title, 'class' => $class, 'width' => $img_width, 'height' => $img_height, )); $img .= "{$span}
"; if ($url) { $params = array( 'href' => $url, 'text' => $img, 'is_trusted' => true, ); $class = elgg_extract('link_class', $vars, ''); if ($class) { $params['class'] = $class; } echo elgg_view('output/url', $params); } else { echo $img; }