wp_thumbnail_max_side_length $file parameter
-
Hi,
I love the new wp_thumbnail_max_side_length filter, but wondering how to get access to the $file parameter sent with it. In the admin-functions.php it says:
$max_side = apply_filters( ‘wp_thumbnail_max_side_length’, 128, $attachment_id, $file );
So I am assuming its sending $file as a parameter with but I fail to access it in my own function:
function custom_thumbsize( $size,$attachment_id, $file )
{
$th_width = 565;
$th_height = 691;// figure out the longest side
$image_attr = getimagesize( $file );
if ( $image_attr[0] > $image_attr[1] ) {
$th_size = $th_width;
//width is > height
} else if ( $image_attr[0] < $image_attr[1] ) {
$th_size = $th_height;
//height > width
}
return $th_size;}
add_filter( “wp_thumbnail_max_side_length”, “custom_thumbsize” );
Any help greatly appreciated,
thanks
TT
- The topic ‘wp_thumbnail_max_side_length $file parameter’ is closed to new replies.