When a picture doesn't have a specific mapped exif_field, a notice shows:

Notice: Undefined index: EXIF:IFD0:ImageDescription in exif_custom_process_entity() (Line 454 of ****/www/sites/all/modules/exif_custom/exif_custom.module).

Line 454 of exif_custom.module:

$array['und']['0']['value'] = $data[$values->exif_field];

A workaround is to check if the value exists first:

if(isset($data[$values->exif_field])){
  $array['und']['0']['value'] = $data[$values->exif_field];
}
else{
  $array['und']['0']['value'] = NULL;
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gaele’s picture

Priority: Normal » Major
Status: Active » Needs review
FileSize
613 bytes

Thanks Kim Kahns. Here's the patch based on the suggestion above.

edwbaker’s picture

Issue summary: View changes
Status: Needs review » Fixed

Thanks! In 7.x-1.x branch for next release.

sazcurrain’s picture

Hi,

The problem reported isn't fully solved. The previous patch only fixes the default option in a switch-case statement, based in the type of the mapped property.

When testing the mapping to a taxonomy term, you get the following messge:

Notice: Undefined index: IPTC:2#025 in exif_custom_process_entity() (line 413 from ***/sites/default/modules/contrib/exif_custom/exif_custom.module).

Here is a patch to fix the problem, using the same workarround from the previous patch.

sazcurrain’s picture

gaele’s picture

Hi sazcurrain, you'd better open a new issue for this patch. This issue has status "Fixed".

edwbaker’s picture

Status: Fixed » Needs review

Changed to needs review.

Status: Needs review » Needs work

The last submitted patch, 4: exif_custom-fix_undefined_index-2055529-3.patch, failed testing.

DamienMcKenna’s picture

FileSize
563 bytes

The patch in #4 needed to be rewritten to adhere to the Drupal coding standards.

I reviewed the code and I think the correct approach might be to skip processing the field if the EXIF value doesn't exist for that file.

DamienMcKenna’s picture

Status: Needs work » Needs review
DamienMcKenna’s picture

recrit’s picture

Status: Needs review » Reviewed & tested by the community

The #8 patch fixed the issue for me.

edwbaker’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Patch applied, will be in the next release.

DamienMcKenna’s picture

Status: Closed (fixed) » Reviewed & tested by the community

@edwbaker: I couldn't see where in the commit log this patch was committed? The current codebase looks like it'd still have this problem.

joseph.olstad’s picture

Status: Reviewed & tested by the community » Fixed

Thanks DamienMckenna

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.