Announcement

#16 2015-10-25 17:52:46

TheDoc
Member
Munich / Germany
2015-10-18
173

Re: Issues in Exif parsing

Hi,

I think I could come up with some remarks about PEL just by looking at the release frequency and compare it to exiftool... 11 commits in 2011 and exactly one in 2005? How long do you think that library will be maintained and adapted to changes in exif due to new cameras, ...? Just for fun, browse http://www.sno.phy.queensu.ca/~phil/exi … story.html in comparison.

In my view there is exactly one standard out there when it comes to exif support. So why not add the capability to use it for anyone who wants to do it?

Just my 2 cents,
Thomas

Offline

 

#17 2015-10-25 18:20:36

jnashpiwigo
Piwigo Team
2014-10-21
254

Re: Issues in Exif parsing

mistic100 wrote:

What is too bad ? seriously I don't understand the whole point here....

I said in my ticket on Github (did you read it ?) that I would like to use PEL, which seems to do everything.
So what's the problem ?

My mistake, I didn't look at the ticket and assumed you meant sticking with the php exif library. (which is broke)

But, with all that, I agree that PEL is a poor choice due to age and support... exiftool is regularly maintained, and could just as easily be included with piwigo distribution.

Last edited by jnashpiwigo (2015-10-25 18:58:20)

Offline

 

#18 2015-10-25 19:23:24

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13786

Re: Issues in Exif parsing

It makes me think about the way Piwigo handles image manipulation (resize/crop/watermark...), where we have 3 alternatives:

* GD
* imagick (embedded class for Image Magick)
* external image magick (direct call to Image Magick command line)

I recommend to use the last one, if available, but we keep the compatibility with the first one GD.

I don't know yet about PEL. It's important to know if it's correctly updated and maintained. We also know that EXIF doesn't change very much, what was working fine 5 years ago still works fine nowadays.

I know that Exiftool is very powerful and is well maintained. We use it in [extension by plg] Write Metadata

Currently, many "raw" EXIF values need to be parsed to be displayed correctly. We do it with [extension by maple] EXIF View. I'm sure this would be useless with a more advanced EXIF reader.

Here is something I find very interesting that we can't get in current EXIF reader: the lens detail. It is in a "specific" field. I know that grum was able to read it from a few makers with [extension by grum] Advanced Metadata but this plugin is not maintained anymore :-/

If Piwigo was designed to run only on dedicated environment with ability to install any package, I would say that exiftool is the best way to go. But we can't rely on its availability. It doesn't mean it's not interesting to use exiftool, but we can't have this solution only.

Offline

 

#19 2015-10-25 20:13:15

jnashpiwigo
Piwigo Team
2014-10-21
254

Re: Issues in Exif parsing

exiftool implementation does make -most- of the exif_view extension not needed... (actually, after I hacked in exiftool functionality, I had to disable exif_view) - although it could easily be modified to use the exiftool values as well... just a different array structure from exiftool output.

With exiftool, I'm able to get pretty much everything I need... (including lens information)

Also, keep in mind that exiftool is just an executable/binary on linux, windows, mac osx, freebsd, not a package really.

Code:

Make
    Apple
Model
    iPhone 6s
DateTimeOriginal
    2015:10:25 13:24:23
FNumber
    2.2
ExposureTime
    1/17
ShutterSpeed
    1/17
ApertureValue
    2.2
ExposureProgram
    Program AE
Flash
    Auto, Did not fire
ISO
    200
FocalLength
    4.2 mm
WhiteBalance
    Auto
ExposureMode
    Auto
MeteringMode
    Multi-segment
GPSLatitude
    XX deg 29' 1.31" N
GPSLongitude
    XX deg 19' 21.20" W
GPSAltitude
    89.2 m Above Sea Level
GPSImgDirectionRef
    True North
latitude
    XX.483697222222
longitude
    -XX.322555555556
LensMake
    Apple
LensModel
    iPhone 6s back camera 4.15mm f/2.2
LightValue
    5.4
IPTC Keywords
    XXXX,iPad

Last edited by jnashpiwigo (2015-10-26 16:04:32)

Offline

 

#20 2015-10-25 20:25:13

jnashpiwigo
Piwigo Team
2014-10-21
254

Re: Issues in Exif parsing

in include/functions_metadata.inc.php

I'm sure there is a MUCH better/safer method for this...  (including a variable set in admin to point to exiftool binary, as with this hack, it assumes you have exiftool avail in your path)  - This is also not fully tested - the array structure is much different, so I'm not sure what else it breaks, but a lot is broken if exif_view is activated

Code:

  // Read EXIF data

//  if ($exif = @read_exif_data($filename) or $exif2 = trigger_change('format_exif_data', $exif=null, $filename, $map))
//  {

  eval('$exif=' . `exiftool -php -q $filename`);
  $exif = $exif[0];
  if ($exif or $exif2 = trigger_change('format_exif_data', $exif=null, $filename, $map))
  {

... [had to fix GPS coord parsing as well] ...

Code:

    // GPS data
// [took entire chunk of code here and replaced]

    if(isset($exif['GPSLatitude'])){
      $lat = $exif['GPSLatitude'];
      $nl = "";
      if(preg_match("/S/",$lat)){
        $nl = "-";
      }
      $lat = preg_replace("/[^0-9\s\.]/","",$lat);
      $lat = preg_replace("/\s+/"," ",$lat);
      $latd = explode(' ',$lat);
      $lat = $latd[0]+((($latd[1]*60)+($latd[2]))/3600);
      $lat = $nl.$lat;
      $result['latitude'] = $lat;
    }

    if(isset($exif['GPSLongitude'])){
      $long = $exif['GPSLongitude'];
      $nl = "";
      if(preg_match("/W/",$long)){
        $nl = "-";
      }
      $long = preg_replace("/[^0-9\s\.]/","",$long);
      $long = preg_replace("/\s+/"," ",$long);
      $longd = explode(' ',$long);
      $long = $longd[0]+((($longd[1]*60)+($longd[2]))/3600);
      $long = $nl.$long;
      $result['longitude'] = $long;
    }

Then I modified my localfilesconfig to include the additional exif fields I wanted

I also edited tools/metadata.php to reflect the exiftool changes as well...

Last edited by jnashpiwigo (2015-10-25 20:39:16)

Offline

 

#21 2015-10-25 20:45:56

jnashpiwigo
Piwigo Team
2014-10-21
254

Re: Issues in Exif parsing

Also works on my Nikon exif...  (with Lens detail)

Code:

Make
    NIKON CORPORATION
Model
    NIKON D7000
DateTimeOriginal
    2015:10:24 14:24:56
FNumber
    4.8
ExposureTime
    1/1250
ExposureProgram
    Not Defined
Flash
    Off, Did not fire
FocalLength
    45.0 mm
WhiteBalance
    Auto1
ExposureMode
    Auto
MeteringMode
    Multi-segment
LightSource
    Unknown
Contrast
    Normal
Saturation
    Normal
Sharpness
    Normal
Lens
    18-105mm f/3.5-5.6
LensID
    AF-S DX VR Zoom-Nikkor 18-105mm f/3.5-5.6G ED
LensFStops
    5.33
IPTC Keywords
    soccer,XXXXX

Offline

 

#22 2015-11-07 23:25:02

TheDoc
Member
Munich / Germany
2015-10-18
173

Re: Issues in Exif parsing

Seems like exiftool works like a charme on my webhoster :-)

So is there any kind of summary, what exif info is used in piwigo? With that I could start to work on having exiftool provide the same output in the same format. First step to replace to replace exif_read_data with something more useful :-)

Thanks,
Thomas

Offline

 

#23 2015-11-08 18:40:27

TheDoc
Member
Munich / Germany
2015-10-18
173

Re: Issues in Exif parsing

I have now started differently and have changed all places where reference to the previous layout was made. Currently hard-code to see if it works (thanks to jnashpiwigo for the example!).

Next step would now to make a plugin out of that. Ayn good pointers / examples to make a new plugin with admin page (to set exiftool path) and to change handling in

include/functions_metadata.inc.php, get_exif_data

plugins/exif_view/main.inc.php , exif_key_translation (if installed)

Thanks in advance,
Thomas

Offline

 

#24 2015-11-08 20:51:07

TheDoc
Member
Munich / Germany
2015-10-18
173

Re: Issues in Exif parsing

Have found http://piwigo.org/doc/doku.php?id=dev:e … _tutorial1 and will try to start from this :-)

Offline

 

#25 2015-11-17 14:38:07

JAK
Member
2013-07-07
62

Re: Issues in Exif parsing

Hi,
I too am getting the 'Warning: strip_tags() expects parameter 1 to be string, array given in /share/MD0_DATA/Web/piwigo/include/functions_metadata.inc.php on line 205' error message with exif view on some images, though I've not noticed it shifting the data fields. Is there a solution to correct this please?

Offline

 

#26 2016-03-17 17:05:57

drlecter
Guest

Re: Issues in Exif parsing

TheDoc wrote:

I have now started differently and have changed all places where reference to the previous layout was made. Currently hard-code to see if it works (thanks to jnashpiwigo for the example!).

Next step would now to make a plugin out of that. Ayn good pointers / examples to make a new plugin with admin page (to set exiftool path) and to change handling in

include/functions_metadata.inc.php, get_exif_data

plugins/exif_view/main.inc.php , exif_key_translation (if installed)

Thanks in advance,
Thomas

Hi Thomas,
have you start with the Plugin Development? I change at this time the code Lines in  tools/metadata.php and functions_metadata.inc.php and its work fine. I disable the exif_view plugin, because i become some errors. I hope i have some Time to look for the Translations to German and fork the exif_view Plugin.
I try some other php exif wrapper, but at this time is the "dirty hack" the easy way.

 

#27 2016-03-17 18:55:08

TheDoc
Member
Munich / Germany
2015-10-18
173

Re: Issues in Exif parsing

I haven't found a way to overwrite the exif plugin only in parts... So hacking seems to be the option or complete re-write.

Offline

 

#28 2016-03-17 19:51:21

drlecter
Member
2016-03-17
21

Re: Issues in Exif parsing

I try to Debug the errors next week. I think i fork the Plugin and use my Testinstallation for this. At this Time i don´t need the Plugin. I was at this time a nice to have Feature :)

The Change with the Exiftool i add to my normal Gallery this Weekend.

Offline

 

#29 2016-06-26 01:39:51

JAK
Member
2013-07-07
62

Re: Issues in Exif parsing

Hi,
Not sure if it helps or not, but I am still getting the same error I referred to several months ago:
Warning: strip_tags() expects parameter 1 to be string, array given in /share/MD0_DATA/Web/piwigo/include/functions_metadata.inc.php on line 205

This error only seems to occur when the photograph has camera created GPS data in its exif.
Is it actually a problem with line 205 ?:     $result[$key] = strip_tags($value);
If so couldn't this be written in another way to avoid the error message?

This means is I cannot presently use the camera's GPS if I intend to upload the photograph to Piwigo. This is crazy!  If Piwigo cannot be made to interpret GPS exif data correctly, is there another solution to make the photograph compatible with Piwigo?  Surely though its just a software coding glitch or its become out of date?

As a temporary fix, I've rem'd out line 205 to prevent it incurring the error. I only upload photos myself so none of unknown origin, though a safe solution would be preferable.

Thanks for your help in advance for getting this long standing issue resolved.

Last edited by JAK (2016-06-26 02:12:53)

Offline

 

#30 2016-06-26 13:07:49

flop25
Piwigo Team
2006-07-06
7037

Re: Issues in Exif parsing

Hello everyone
use /tools/metadata.php and report back the results
Also try software such as XnView to reformat/check the validity of the metadata


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact