function odsherredweb_image_style($variables) { // Determine the dimensions of the styled image. $dimensions = array('width' => $variables['width'], 'height' => $variables['height']); image_style_transform_dimensions($variables['style_name'], $dimensions); $variables['width'] = $dimensions['width']; $variables['height'] = $dimensions['height']; $variables['attributes'] = array('class' => $variables['style_name']); // Determine the url for the styled image. $variables['path'] = image_style_url($variables['style_name'], $variables['path']); return theme('image', $variables); }
function newsweek_image_style($variables) { // Determine the dimensions of the styled image. $dimensions = array('width' => $variables['width'], 'height' => $variables['height']); image_style_transform_dimensions($variables['style_name'], $dimensions); $variables['width'] = $dimensions['width']; $variables['height'] = $dimensions['height']; // Determine the URL for the styled image. $variables['path'] = image_style_url($variables['style_name'], $variables['path']); if (module_exists('ibtmedia_special_item') && ibtmedia_special_item_is_any_special_item_page()) { $variables['title'] = NULL; } return theme('image', $variables); }
/** * Override for theme_image_style * Adds custom styles for this theme */ function plain_response_image_style($variables) { // Determine the dimensions of the styled image. $dimensions = array('width' => $variables['width'], 'height' => $variables['height']); image_style_transform_dimensions($variables['style_name'], $dimensions); $variables['width'] = $dimensions['width']; $variables['height'] = $dimensions['height']; $original_path = $variables['path']; $variables['attributes']['data-originalsrc'] = $original_path; // Determine the url for the styled image. $variables['path'] = image_style_url($variables['style_name'], $original_path); // Use quarter as default size. if (strpos($variables['style_name'], 'plain_response_') === 0) { $variables['path'] = image_style_url('plain_response_quarter', $original_path); if (!isset($variables['attributes']['class'])) { $variables['attributes']['class'] = ''; } $variables['attributes']['class'] .= ' ' . str_replace('plain_response_', '', $variables['style_name']); unset($variables['width']); unset($variables['height']); } return theme('image', $variables); }
/** * Implements theme_image_style(). */ function cu_omega_image_style(&$vars) { // Determine the dimensions of the styled image. $dimensions = array('width' => $vars['width'], 'height' => $vars['height']); image_style_transform_dimensions($vars['style_name'], $dimensions); $vars['width'] = $dimensions['width']; $vars['height'] = $dimensions['height']; // Determine the url for the styled image. $vars['path'] = image_style_url($vars['style_name'], $vars['path']); $vars['attributes']['class'] = array('image-' . $vars['style_name']); return theme('image', $vars); }
<?php /** * OLC TeX Picture * @style_name The name of the Drupal image style * @file The file object * @ppi The pixels per inch (default is 300 ppi) */ $p_style = $variables['data']['style_name']; $file = $variables['data']['file']; $p_fid = $file['fid']; $p_filename = $file['filename']; $p_path = 'picture/' . $p_fid . '-' . $p_style . '-' . $p_filename; image_style_transform_dimensions($p_style, $file); $p_ppi = isset($variables['ppi']) ? $variables['data']['ppi'] : 72; $p_width = round($file['width'] / $p_ppi, 2); $p_height = round($file['height'] / $p_ppi, 2); ?> \includegraphics [ width=<?php echo $p_width; ?> in, height=<?php echo $p_height; ?> in ]{"<?php echo $p_path; ?>
exit; } $extension = pathinfo($filename, PATHINFO_EXTENSION); $hfilesize = atento_get_human_size($filesize); $view = file_create_url($uri); $file = $elements['#file']; $uri_download = file_entity_download_uri($file); $download = url($uri_download['path'], $uri_download['options']); $file_thumbnail = ' '; if ($type == 'image') { $vars = array('style_name' => 'file_preview', 'path' => $uri, 'width' => $width, 'height' => $height); $file_thumbnail = theme_image_style($vars); $vars2 = $vars; $vars2['style_name'] = 'full'; $dimensions = array('width' => $vars2['width'], 'height' => $vars2['height']); image_style_transform_dimensions($vars2['style_name'], $dimensions); $vars2['width'] = $dimensions['width']; $vars2['height'] = $dimensions['height']; $vars2['path'] = image_style_url($vars2['style_name'], $vars2['path']); $view = $vars2['path']; $data_size = "{$vars2['width']}x{$vars2['height']}"; } else { // Get Image for Extension $file_thumbnail = atento_get_extension_image($extension); } $filename_print = check_plain($filename); if (isset($file->description) && !empty($file->description)) { $filename_print = check_markup($file->description, 'full_html'); } ?> <div class="file-preview">
function cca_image_style($variables) { // Determine the dimensions of the styled image. $dimensions = array('width' => $variables['width'], 'height' => $variables['height']); image_style_transform_dimensions($variables['style_name'], $dimensions); // Determine the URL for the styled image. $variables['path'] = image_style_url($variables['style_name'], $variables['path']); return theme('image', $variables); }
/** * Override theme_image_style(). * Use the required image style as usual, except if a special * imagestylename_themename style exists, in which case that style * overrides the default. */ function glossy_image_style($variables) { global $theme; if (array_key_exists($variables['style_name'] . '_' . $theme, image_styles())) { $variables['style_name'] = $variables['style_name'] . '_' . $theme; } // Starting with Drupal 7.9, the width and height attributes are // added to the img tag. Adding the if clause to conserve // compatibility with Drupal < 7.9 if (function_exists('image_style_transform_dimensions')) { // Determine the dimensions of the styled image. $dimensions = array( 'width' => $variables['width'], 'height' => $variables['height'], ); image_style_transform_dimensions($variables['style_name'], $dimensions); $variables['width'] = $dimensions['width']; $variables['height'] = $dimensions['height']; } $variables['path'] = image_style_url($variables['style_name'], $variables['path']); return theme('image', $variables); }
/** * Implements theme_image_formatter(). * * Default image for vp_contacts. */ function vp_theme_image_formatter($variables) { $item = $variables['item']; $image = array('path' => $item['uri']); if (array_key_exists('alt', $item)) { $image['alt'] = $item['alt']; } if (isset($item['attributes'])) { $image['attributes'] = $item['attributes']; } if (isset($item['width']) && isset($item['height'])) { $image['width'] = $item['width']; $image['height'] = $item['height']; } // Do not output an empty 'title' attribute. if (isset($item['title']) && drupal_strlen($item['title']) > 0) { $image['title'] = $item['title']; } if ($variables['image_style']) { $image['style_name'] = $variables['image_style']; $output = theme('image_style', $image); } else { $output = theme('image', $image); } // Default image for vp_contacts. if ($variables['image_style'] === 'search_contact_thumbnail' && strpos($image['path'], 'no-profile-image') !== FALSE) { $style = image_style_load('search_contact_thumbnail'); $dimensions = array(); image_style_transform_dimensions('search_contact_thumbnail', $dimensions); $output = '<img src="/' . drupal_get_path('module', 'vp_contact') . '/no-profile-image_w104.png" height="' . $dimensions['height'] . '" width="' . $dimensions['width'] . '" alt="" />'; } // The link path and link options are both optional, but for the options to be // processed, the link path must at least be an empty string. if (isset($variables['path']['path'])) { $path = $variables['path']['path']; $options = isset($variables['path']['options']) ? $variables['path']['options'] : array(); // When displaying an image inside a link, the html option must be TRUE. $options['html'] = TRUE; $output = l($output, $path, $options); } return $output; }