Download & Extend

warning: exif_read_data... [function.exif-read-data]: Incorrect APP1 Exif Identifier Code in module.graphic.jpg.php, line 59

Project:getID3()
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

I just got this error when trying to upload an imagefield

warning: exif_read_data(3.jpg) [function.exif-read-data]: Incorrect APP1 Exif Identifier Code in sites/all/modules/getid3/getid3/module.graphic.jpg.php on line 59.

Comments

#1

I also just got this exact error today when uploading an imagefield. I have not used this function for a month or more, so I can't be sure when it first appeared, but it did not used to happen, and I have not made any changes to my getID3() 1.7.9-20090308 code installation. I presume there must therefore be a conflict with an update in perhaps Imagefield or Imagecache?

#2

I see this error too. Despite the error, the image uploads and is rendered correctly.

#3

* warning: exif_read_data(R6992.jpg) [function.exif-read-data]: Incorrect APP1 Exif Identifier Code in /home/www-tol/ansishin/public/dada-after.com/site/sites/all/modules/getid3/getid3/module.graphic.jpg.php on line 59.
* warning: exif_read_data(B6704_0.jpg) [function.exif-read-data]: Incorrect APP1 Exif Identifier Code in /home/www-tol/ansishin/public/dada-after.com/site/sites/all/modules/getid3/getid3/module.graphic.jpg.php on line 59.
* warning: exif_read_data(R6858_0.jpg) [function.exif-read-data]: Incorrect APP1 Exif Identifier Code in /home/www-tol/ansishin/public/dada-after.com/site/sites/all/modules/getid3/getid3/module.graphic.jpg.php on line 59.
* warning: exif_read_data(_DAD6710_0.jpg) [function.exif-read-data]: Incorrect APP1 Exif Identifier Code in /home/www-tol/ansishin/public/dada-after.com/site/sites/all/modules/getid3/getid3/module.graphic.jpg.php on line 59.

me too if some1 can fix that plz ^^

#4

anyone have an image we can test it out on? you also might try upgrading the getid3 library to the new 1.7.9 release.

#5

Same error and I am on version 1.7.9

#6

subscribe

#7

Having issue, I guess I will disable FileField and Getid3 until this is resolved.
warning: exif_read_data(SaraHaze_20100121_0003_0.jpg) [function.exif-read-data]: Incorrect APP1 Exif Identifier Code in /home/-----/public_html/modules/getid3/getid3/module.graphic.jpg.php on line 59.

#8

subscribe

#9

subscribe

#10

Title:Error » warning: exif_read_data... [function.exif-read-data]: Incorrect APP1 Exif Identifier Code in module.graphic.jpg.php, line 59

I am not having this issue, but the title was too generic to be of any help. Now it is easier to search for it as well ;)

#11

I have this error with 6.x-1.3. Download a sample image at http://graphics8.nytimes.com/images/2010/04/17/opinion/18bono2_art/18bon... .

#12

It looks like the "getid3.module" has an issue.
(Located in: sites\all\modules\getid3)

I solved the problem by editing the "getid3.module" file:
Comment out the following (line 69 > 76):

<?php
/**
* Analyze file and return its media information.
*/
/*
function &getid3_analyze($path) {
  $info = array();
  if($id3 = &getid3_instance()) {
    $info = $id3->analyze($path);
    unset($id3);
  }
  return $info;
}
*/
?>

And add this instead:

<?php
/**
* Analyze file and return its media information.
*/
function &getid3_analyze($path) {
 
$info = array();
  if(
$id3 = &getid3_instance()) {
    try {
       
$info = $id3-> analyze($path);
    } catch (
getid3_exception $e) {
       
// you could do something here with the error, maybe saved in drupal's error log
   
}
    unset(
$id3);
  }
  return
$info;
}
?>

I don't know if this will work for you, but it sure did the trick for me.

Arno

#13

Catching the error looks like a solution. Could we get this committed?

#14

I just had the same error when uploading an image through wysiwyg imageupload mod.
*Used a different image, didn't have the problem.

#15

I found the same error when attempting to process JPEG files created in Photoshop with XMP data in the APP1 tag. The fix I came up with was to verify the APP1 tag contained Exif data before attempting to parse it.

The change is in the sites/all/libraries/getid3/module.graphic.jpg.php line 57:

was: if (function_exists('exif_read_data') {

fix: if (function_exists('exif_read_data')
&& strpos ($imageinfo['APP1'], 'Exif') === 0) {

#16

Version:6.x-1.2» 6.x-1.3

I'm getting the same error message but neither #12 nor #15 solved it for me.

#17

I got this same error using JPGs from Photoshop. Re-saving without metadata allowed the file to upload without problems. Having done some research on the error message, it seems this is a problem with the getid3 library with files from recent versions of Photoshop.

#18

same problem here

#19

Had same warning and simply turned off error messages on the function exif_read_data(), so

change line 59, in file "/sites/all/libraries/getid3/getid3/module.graphic.jpg.php", from:
$ThisFileInfo['jpg']['exif'] = exif_read_data($ThisFileInfo['filenamepath'], '', true, false);

to:
$ThisFileInfo['jpg']['exif'] = @exif_read_data($ThisFileInfo['filenamepath'], '', true, false);

#20

Figured it is worth noting that the same issue has been brought up in the getID3() support forums.

The posted solution, Fix for Exif errors on non-Exif JPEGs, is to...


Add a check on line 57:
current: if (function_exists('exif_read_data')) {
fix: if (function_exists('exif_read_data') && strpos ($imageinfo['APP1'], 'Exif') === 0) {

This might work better then suppressing all errors.

#21

#19 with the #20 applied fixed it for me.
The getId3 library really needs a rewrite.

#22

#19 worked for me, too, for getID3() 1.7.9-20090308. Thanks!

#23

I can't get the fix in #12 (on the module file itself) to work.

Here's the fix from #20 as a patch on the getid3 library folder.

AttachmentSize
556970.getid3_.incorrect-exif-error.patch 543 bytes

#24

[function.exif-read-data]: Incorrect APP1 Exif Identifier Code in /home/cyberfan/htdocs/sites/all/libraries/getid3/getid3/module.graphic.jpg.php on line 59.
warning: exif_read_data(4454707446_db0268b367_m.jpg) [function.exif-read-data]: Incorrect APP1 Exif Identifier Code in /home/cyberfan/htdocs/sites/all/libraries/getid3/getid3/module.graphic.jpg.php on line 59

So what is the right way? # 23 or #20??????

#25

As I wrote, my patch in #23 is simply the change in #20 but as a patch, so it's easier to work with.

#26

got it, thanks

#27

I think the solution from #12 is the right way to handle this. While #20 fixes the issue it's a bit of a problem as we're patching code for an upstream library. Also, there are other exceptions that can be raised in getid3 that won't be solved by #20. The attached patch implements @avanmosel's suggestion in #12 and also adds a watchdog message for this. I don't believe that exceptions raised from the getid3 library should necessarily lead to Drupal failing, but reporting the errors is important.

AttachmentSize
getid3_exception_handling.patch 456 bytes

#28

I applied the patch on #27 and the error is still there.

#29

I applied the patch in #27 and the error is still there, fresh install, same code on other sites and they are not having an issue. edit
Change the image from a gif to jpg and the problem went away. Not sure what that means, but with the patch applied and using a jpg I am no longer getting errors. edit
Then added another product and an getting errors with either file format, so back to no clue.

#30

subscribe

#31

Suppressing errors, isn't that bad practice? I think the checking (exif_imagetype($ThisFileInfo['filenamepath']) !== false) is the correct way to prevent errors.

#32

Hello,

I had the same error, I upload another pic and there is no error so I believe it is related but some image, so my advice is: "do not play with the code" just pick another photo.

#33

Why is this issue still unassigned?
Is this issue resolved in 6.x-1.4?
Should it be moved to 6.x-1.4 queue instead?

#34

Version:6.x-1.3» 6.x-1.x-dev

...issues are fixed in latest dev versions - then a stable version is released including the fix(es).

#35

It seems that this error comes up when the getid3 library is outdated.

Upgrading to the most current version of getid3 library (not the module) solve this issue for me.

Update: getid3 library used was 1.9.1 With getID3() module version 6.x-1.5

#36

Status:active» closed (won't fix)

Based on #35 I'm closing this.

#37

Well, I have just updated all modules, so my getid3 is NOT outdated, and I am having more of these errors than ever! So, I'd hate to see this closed, since it has never really been resolved. Please, this should not be closed!

#38

Please post your versions and re-open if you think it's necessary .

#39

@willow315: be sure you're updating the getID3 library, not the getID3 module.