2

I'm using Drupal 7. Is there a hook for generating image from image style? For example. I upload an image. When image is displayed for the first time, drupal generates image style. Can I hook to that event somehow?

3 Answers 3

2

The image style hooks are documented here:

http://api.drupal.org/api/drupal/modules%21image%21image.api.php/7

  • hook_image_default_styles: Provide module-based image styles for reuse throughout Drupal.
  • hook_image_effect_info: Define information about image effects provided by a module.
  • hook_image_effect_info_alter: Alter the information provided in
  • hook_image_effect_info.
  • hook_image_styles_alter: Modify any image styles provided by other modules or the user.
  • hook_image_style_delete: Respond to image style deletion.
  • hook_image_style_flush: Respond to image style flushing.
  • hook_image_style_save: Respond to image style updating.

Nothing for the actual image generation process, if that's what you're looking for.

See image_style_deliver for the details on the image generation

2
  • Thanks for the image_style_deliver() function:) hook_file_load can be injected there:)
    – user12987
    Feb 14, 2013 at 8:14
  • Ah yes, glad it's sorted! Feb 14, 2013 at 8:43
1

You can define any number of custom image styles (presets). You can then call an image to be embedded using a specific image_style with theme_image_style

0

Hooking your own code into the image derivative generation, image link generation and menu routing is very difficult. In the imagecache_actions contrib module we have had a lot of questions about it. I think that comments 12, 13 and 14 of issue "Change file format :: Doesn't change the file extension" best answer what can be done and what trouble you will probably run into.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.