You are here

function _user_badges_build_image in User Badges 6.2

Same name and namespace in other branches
  1. 6 user_badges.module \_user_badges_build_image()
  2. 7 user_badges.module \_user_badges_build_image()
  3. 7.2 user_badges.module \_user_badges_build_image()
  4. 7.3 user_badges.module \_user_badges_build_image()

Helper function to produce badge image.

2 calls to _user_badges_build_image()
theme_user_badge in ./user_badges.module
Return html representation of a badge image (note: theme_image does the check_plaining)
user_badges_get_roles in ./user_badges.module
Returns an array where keys are role ids (rid) and values are the badge ids (bid) associated with that role These values are assigned on admin/user/user_badges/roles

File

./user_badges.module, line 1066
@brief User Badges module file

Code

function _user_badges_build_image($badge) {
  if (!isset($badge->class)) {
    $badge->class = 'badge ' . _user_badges_class($badge);
  }
  if (variable_get('user_badges_imagecache', 0)) {
    $image = theme('imagecache', 'user-badges', $badge->image, $badge->name, $badge->name, array(
      'class' => $badge->class,
    ));
  }
  else {

    // If we have a full image URL, don't require theme_image to get the size
    // (it only breaks).
    $get_size = valid_url($badge->image, TRUE);
    $image = theme('image', $badge->image, $badge->name, $badge->name, array(
      'class' => $badge->class,
    ), !$get_size);
  }
  return $image;
}