WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
Line | Code |
---|---|
1716 | if ( $type && 0 === strpos( $type, 'image/' ) && function_exists('getimagesize') ) { |
1717 |
|
1718 | // Attempt to figure out what type of image it actually is |
1719 | $imgstats = @getimagesize( $file ); |
1720 |
|
1721 | // If getimagesize() knows what kind of image it really is and if the real MIME doesn't match the claimed MIME |
1722 | if ( !empty($imgstats['mime']) && $imgstats['mime'] != $type ) { |
1723 | // This is a simplified array of MIMEs that getimagesize() can detect and their extensions |
1724 | // You shouldn't need to use this filter, but it's here just in case |
1725 | $mime_to_ext = apply_filters( 'getimagesize_mimes_to_exts', array( |
1726 | 'image/jpeg' => 'jpg', |
1727 | 'image/png' => 'png', |
1728 | 'image/gif' => 'gif', |
1729 | 'image/bmp' => 'bmp', |
1730 | 'image/tiff' => 'tif', |
1731 | ) ); |
1732 |
|
1733 | // Replace whatever is after the last period in the filename with the correct extension |
1734 | if ( ! empty( $mime_to_ext[ $imgstats['mime'] ] ) ) { |