wp_image_maybe_exif_rotate
Filters the $orientation value to correct it before rotating or to prevent rotating the image.
Usage
add_filter( 'wp_image_maybe_exif_rotate', 'wp_kama_image_maybe_exif_rotate_filter', 10, 2 );
/**
* Function for `wp_image_maybe_exif_rotate` filter-hook.
*
* @param int $orientation EXIF Orientation value as retrieved from the image file.
* @param string $file Path to the image file.
*
* @return int
*/
function wp_kama_image_maybe_exif_rotate_filter( $orientation, $file ){
// filter...
return $orientation;
}
- $orientation(int)
- EXIF Orientation value as retrieved from the image file.
- $file(string)
- Path to the image file.
Changelog
| Since 5.3.0 | Introduced. |
Where the hook is called
wp_image_maybe_exif_rotate
wp-includes/class-wp-image-editor.php 505
$orientation = apply_filters( 'wp_image_maybe_exif_rotate', $orientation, $this->file );