function _outline_designer_validate_image_resolution in Outline Designer 7        
                          
                  
                        Same name and namespace in other branches
- 6 outline_designer.module \_outline_designer_validate_image_resolution()
 
 
File
 
   - ./outline_designer.module, line 782
 
  - Massive usability improvement for quickly structuring / creating content.
 
Code
function _outline_designer_validate_image_resolution(&$file, $dimensions) {
  $errors = array();
  
  if ($info = image_get_info($file->filepath)) {
    
    list($width, $height) = explode('x', $dimensions);
    if ($info['width'] != $width || $info['height'] != $height) {
      
      if (image_get_toolkit() && image_scale_and_crop($file->filepath, $file->filepath, $width, $height)) {
        drupal_set_message(t('The image was resized to the allowed dimensions of %dimensions pixels.', array(
          '%dimensions' => $dimensions,
        )));
        
        clearstatcache();
        $info = image_get_info($file->filepath);
        $file->filesize = $info['file_size'];
      }
      else {
        $errors[] = t('Image dimensions need to be %dimensions pixels.', array(
          '%dimensions' => $maximum_dimensions,
        ));
      }
    }
  }
  return $errors;
}