You are here

function feeds_imagegrabber_widget_file_validator in Feeds Image Grabber 7

Validate the file object with field instance specific validators.

Parameters

$file: The file object to be validated.

$instance: The instance info of the image field.

Return value

An array containing the errors (if any) which occurs while running the validators.

1 call to feeds_imagegrabber_widget_file_validator()
feeds_imagegrabber_feeds_set_target in ./feeds_imagegrabber.module
Callback for mapping. Here is where the actual mapping happens.

File

./feeds_imagegrabber.module, line 719
Grabs images for items imported using the feeds module.

Code

function feeds_imagegrabber_widget_file_validator($file, $instance) {
  $settings = $instance['settings'];

  // Create the list of validators.
  $image_validators = array();
  $image_validators['file_validate_name_length'] = array();
  if ($settings['max_resolution'] || $settings['min_resolution']) {
    $image_validators['file_validate_image_resolution'] = array(
      $settings['max_resolution'],
      $settings['min_resolution'],
    );
  }
  $file_validators = file_field_widget_upload_validators(NULL, $instance);
  $validators = array_merge($file_validators, $image_validators);
  $errors = file_validate($file, $validators);
  return $errors;
}