Make WordPress Core


Ignore:
Timestamp:
12/20/2007 10:18:28 PM (17 years ago)
Author:
westi
Message:

Ensure we don't call exif_read_data() on unsupported file types. Fixes #5397 props DD32

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/image.php

    r6363 r6438  
    250250    if ( !file_exists( $file ) )
    251251        return false;
     252
     253    list(,,$sourceImageType) = getimagesize( $file );
    252254
    253255    // exif contains a bunch of data we'll probably never need formatted in ways that are difficult to use.
     
    288290
    289291    // fetch additional info from exif if available
    290     if ( is_callable('exif_read_data') ) {
     292    if ( is_callable('exif_read_data') && in_array($sourceImageType, apply_filters('wp_read_image_metadata_types', array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM)) ) ) {
    291293        $exif = exif_read_data( $file );
    292294        if (!empty($exif['FNumber']))
     
    305307    // FIXME: try other exif libraries if available
    306308
    307     return apply_filters( 'wp_read_image_metadata', $meta, $file );
     309    return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType );
    308310
    309311}
Note: See TracChangeset for help on using the changeset viewer.