Experimental Project

This is a sandbox project, which contains experimental code for developer use only.

At the install, the module will generate many new images styles
Don't forget to add the new field "image_crop" to at least one content type

Example :

Default :

  • Thumbnail (100x100)
  • Medium (220x220)
  • Large (480x480)

Generated image style :

  1. large_center_bottom
  2. large_center_center
  3. large_center_top
  4. large_left_center
  5. large_right_center
  6. medium_center_bottom
  7. medium_center_center
  8. medium_center_top
  9. medium_left_center
  10. medium_right_center
  11. thumbnail_center_bottom
  12. thumbnail_center_center
  13. thumbnail_center_top
  14. thumbnail_left_center
  15. thumbnail_right_center

The configuration page allow you to change the cropping ratio /admin/config/media/image-crop

Explanation :

If ratio = 1.5 Thumbnail size = 100x100 BEFORE CROPPING : thumbnail_center_top size = 150x150 AFTER CROPPING : thumbnail_center_top size = 100x100

_center_top mean that 50 pixel are removed from the right and bottom

_center_bottom mean that 50 pixel are removed from the right and top

Regenerate image style after add a new one :

/admin/config/media/image-crop

Click "Save configuration", previous generated style will be removed and recreated

Dev
Now instead of calling :

image_style_url([ STYLE NAME ], [ URI ]);
Use :

get_image_cropped($node, [ STYLE NAME ]);

Project Information