You are here

function template_preprocess_insert_image in Insert 7

Same name and namespace in other branches
  1. 8.2 insert.module \template_preprocess_insert_image()
  2. 8 insert.module \template_preprocess_insert_image()
  3. 6 includes/insert.inc \template_preprocess_insert_image()

Preprocess variables for the insert-image.tpl.php file.

File

includes/insert.inc, line 73
Insert support for generic files.

Code

function template_preprocess_insert_image(&$vars) {
  $vars['file'] = file_load($vars['item']['fid']);
  $absolute = isset($vars['widget']['settings']['insert_absolute']) ? $vars['widget']['settings']['insert_absolute'] : NULL;
  $vars['url'] = insert_create_url($vars['file']->uri, $absolute);
  $vars['class'] = !empty($vars['widget']['settings']['insert_class']) ? $vars['widget']['settings']['insert_class'] : '';
  $image_info = @image_get_info($vars['file']->uri);
  $vars['width'] = isset($image_info['width']) ? $image_info['width'] : '';
  $vars['height'] = isset($image_info['height']) ? $image_info['height'] : '';
}