You are here

function photos_handler_field_photos_image::render in Album Photos 7.3

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides views_handler_field::render

File

inc/views/handlers/photos_handler_field_photos_image.inc, line 45
Definition of photos_handler_field_photos_image.

Class

photos_handler_field_photos_image
Field handler to provide simple renderer that allows using a themed image.

Code

function render($values) {
  if ($this->options['image_style'] && module_exists('image')) {
    if ($picture_fid = $this
      ->get_value($values)) {
      $picture = file_load($picture_fid);
      $picture_filepath = $picture->uri;
    }
    if (file_valid_uri($picture_filepath)) {
      $output = theme('image_style', array(
        'style_name' => $this->options['image_style'],
        'path' => $picture_filepath,
      ));
      if ($this->options['link_photo_to_album_image'] && user_access('view photo')) {
        $output = l($output, "photos/image/{$picture_fid}", array(
          'html' => TRUE,
        ));
      }
    }
    else {
      $output = '';
    }
  }
  else {

    // @todo default output if no imagestyle selected.
    $output = $this
      ->get_value($values);
  }
  return $output;
}