WordPress.org

Make WordPress Core

Changeset 6438


Ignore:
Timestamp:
12/20/07 22:18:28 (8 years ago)
Author:
westi
Message:

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

Location:
trunk
Files:
2 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} 
  • trunk/wp-includes/compat.php

    r6387 r6438  
    179179    define('IMAGETYPE_PNG', 3); 
    180180 
     181if (!defined('IMAGETYPE_TIFF_MM')) 
     182    define('IMAGETYPE_TIFF_MM',7); 
     183 
     184if (!defined('IMAGETYPE_TIFF_MM')) 
     185    define('IMAGETYPE_TIFF_MM',8); 
    181186 
    182187?> 
Note: See TracChangeset for help on using the changeset viewer.