Is there a way to tell drupal that my module has a theme function which usually only works in my theme?
If I write in my theme's template.php:
function mytheme_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']);
// do additional stuff
return theme('image', $variables);
}
everything works fine. If I move this code to a module it does not work, though:
function mymodule_image_style($variables) {
// code
return theme('image', $variables);
}
How can I use the theme_image_style function/hook in my module?