function image_field_presave
image_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items)
Implements hook_field_presave().
File
- modules/image/image.field.inc, line 230
- Implement an image field, based on the file module's file field.
Code
function image_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) { file_field_presave($entity_type, $entity, $field, $instance, $langcode, $items); // Determine the dimensions if necessary. foreach ($items as &$item) { if (!isset($item['width']) || !isset($item['height'])) { $info = image_get_info(file_load($item['fid'])->uri); if (is_array($info)) { $item['width'] = $info['width']; $item['height'] = $info['height']; } } } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!image!image.field.inc/function/image_field_presave/7.x