You are here

function retina_images_retina_style_preview in Retina Images 7

Menu callback for previewing a retinafied image.

1 string reference to 'retina_images_retina_style_preview'
retina_images_menu in ./retina_images.module
Implements hook_menu().

File

./retina_images.module, line 439
This module provides an image effect to assist in outputing high resolution images.

Code

function retina_images_retina_style_preview($style) {
  $image = $sample_image = variable_get('image_style_preview_image', drupal_get_path('module', 'image') . '/sample.png');
  $image_tag = theme('image_style', array(
    'style_name' => $style['name'],
    'path' => $image,
  ));
  $final_output_size = array(
    'width' => 0,
    'height' => 0,
  );
  image_style_transform_dimensions($style['name'], $final_output_size);
  $filename = drupal_basename($image);
  $output = <<<EOT
<html>
  <head>
  <title>{<span class="php-variable">$filename</span>} {<span class="php-variable">$final_output_size</span>[<span class="php-string">'width'</span>]}&times;{<span class="php-variable">$final_output_size</span>[<span class="php-string">'height'</span>]} pixels</title>
  </head>
  <body>
    {<span class="php-variable">$image_tag</span>}
  </body>
</html>

EOT;
  print $output;
  drupal_exit();
}