function _imagefield_scale_image in ImageField 5        
                          
                  
                        Same name and namespace in other branches
- 5.2 imagefield.module \_imagefield_scale_image()
 
 
1 call to _imagefield_scale_image()
  - _imagefield_widget_prepare_form_values in ./imagefield.module
 
  
 
File
 
   - ./imagefield.module, line 316
 
  - Defines an image field type.
imagefield uses content.module to store the fid, and the drupal files 
table to store the actual file data.
 
Code
function _imagefield_scale_image($file, $resolution = 0) {
  $info = image_get_info($file['filepath']);
  if ($info) {
    list($width, $height) = explode('x', $resolution);
    if ($width && $height) {
      $result = image_scale($file['filepath'], $file['filepath'], $width, $height);
      if ($result) {
        $file['filesize'] = filesize($file['filepath']);
        drupal_set_message(t('The image was resized to fit within the maximum allowed resolution of %resolution pixels', array(
          '%resolution' => $resolution,
        )));
      }
    }
  }
  return $file;
}