WordPress.org

Plugin Directory

Changeset 682161


Ignore:
Timestamp:
03/15/13 06:07:02 (13 months ago)
Author:
alexdunae
Message:

Check for oversize images before attempting to smush

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-smushit/trunk/wp-smushit.php

    r682159 r682161  
    2626define('WP_SMUSHIT_UA', 'WP Smush.it/1.6.0 (+http://dialect.ca/code/wp-smushit)'); 
    2727define('WP_SMUSHIT_PLUGIN_DIR', dirname(plugin_basename(__FILE__))); 
     28define('WP_SMUSHIT_MAX_BYTES', 1048576); 
    2829 
    2930define('WP_SMUSHIT_AUTO', intval(get_option('wp_smushit_smushit_auto', 0))); 
     
    143144        return array($file, $msg); 
    144145    } 
     146 
     147  $file_size = filesize($file_path); 
     148  if ( $file_size > WP_SMUSHIT_MAX_BYTES ) { 
     149    $msg = sprintf(__("<a href='http://developer.yahoo.com/yslow/smushit/faq.html#faq_restrict'>Too big</a> for Smush.it (%s)", WP_SMUSHIT_DOMAIN), wp_smushit_format_bytes($file_size)); 
     150    return array($file, $msg); 
     151  } 
    145152 
    146153    // check that the file is within the WP_CONTENT_DIR 
Note: See TracChangeset for help on using the changeset viewer.