Skip to content

Instantly share code, notes, and snippets.

View bradt's full-sized avatar

Brad Touesnard bradt

View GitHub Profile
@bradt
bradt / wp-image-crop-position.php
Created November 29, 2011 20:56
WordPress: Set an image's crop position and rotates images based on EXIF information if necessary
<?php
/* Example Usage:
* bt_add_image_size( 'product-screenshot', 300, 300, array( 'left', 'top' ) );
* bt_add_image_size( 'product-feature', 460, 345, array( 'center', 'top' ) );
*/
add_filter( 'intermediate_image_sizes_advanced', 'bt_intermediate_image_sizes_advanced' );
add_filter( 'wp_generate_attachment_metadata', 'bt_generate_attachment_metadata', 10, 2 );
/**