Announcement

#31 2016-11-30 15:59:40

wittypluck
Member
2016-09-05
24

Re: EXIF GPS data not read

Hello volare,

Could you post :
- Piwigo version
- PHP version
- values of show_exif and use_exif configuration flags (in local/config/config.inc.php)
- an example of picture with gps data which doesn't work

All the issues I had, or heard of, were either an incorrect piwigo configuration, or a recent major regression in some versions of PHP, or a more long term issue with PHP failing to load the end part of exif data on some particular files (especially after the "maker note" section).

Offline

 

#32 2016-12-01 07:37:49

volare
Member
Bavaria
2016-11-13
13

Re: EXIF GPS data not read

Hello wittypluck ,

- Piwigo 2.8.3
- PHP Version 5.5.9-1ubuntu4.20

// show_exif: Show EXIF metadata on picture.php (table or line presentation // avalaible) $conf['show_exif'] = true;
// show_exif_fields : in EXIF fields, you can choose to display fields in // sub-arrays, for example ['COMPUTED']['ApertureFNumber']. for this, add // 'COMPUTED;ApertureFNumber' in $conf['show_exif_fields'] // // The key displayed in picture.php will be $lang['exif_field_Make'] for // example and if it exists. For compound fields, only take into account the // last part : for key 'COMPUTED;ApertureFNumber', you need // $lang['exif_field_ApertureFNumber']
//
// for PHP version newer than 4.1.2 :
// $conf['show_exif_fields'] = array('CameraMake','CameraModel','DateTime');
//
$conf['show_exif_fields'] = array(
   'Make',
   'Model',
   'DateTimeOriginal',
   'COMPUTED;ApertureFNumber'
   );

// use_exif: Use EXIF data during database synchronization with files // metadata $conf['use_exif'] = true;

// use_exif_mapping: same behaviour as use_iptc_mapping $conf['use_exif_mapping'] = array(
   'date_creation' => 'DateTimeOriginal'
   );

// allow_html_in_metadata: in case the origin of the photo is unsecure (user // upload), we remove HTML tags to avoid XSS (malicious execution of // javascript) $conf['allow_html_in_metadata'] = false;

// decide which characters can be used as keyword separators (works in EXIF // and IPTC). Coma "," cannot be removed from this list.
$conf['metadata_keyword_separator_regex'] = '/[.,;]/';


here is the link to the gallery :

http://beuschel.com/piwigo/picture.php?/301/category/5


- before upload the META/EXIF data like LAT /  LONG are available

- looked into the META/EXIF via PIWIGO gallery  LAT /  LONG are not available ( not visible )

- when I download this pic the META/EXIF are again visible

I personally think after updating to OSM version d the problem came up,
before the OSM update system was working fine , but this is a guess .

The PHP version has not been changed in that time.


greetings  volare

Offline

 

#33 2016-12-02 00:05:03

wittypluck
Member
2016-09-05
24

Re: EXIF GPS data not read

Hi volare,

First, I uploaded your image in my gallery and the GPS coordinates are fine. So no problem with Piwigo or OpenStreetMap.
I use Piwigo 2.8.3 and OSM 2.8.d

For the rest of my post I will be speculating so take it with a grain of salt.

Your version of PHP seeems to be the Ubuntu "Trusty" package of PHP5 with security updates enabled.
Your version dates from October 2016 :
https://launchpad.net/ubuntu/+source/ph … ubuntu4.20
The previous version is from July 2016 :
https://launchpad.net/ubuntu/+source/ph … ubuntu4.19

Now, the major regression I was talking about in PHP was caused by two security fixes on Exif data reading :
https://bugs.php.net/bug.php?id=72618
https://bugs.php.net/bug.php?id=72603
The issue is documented and fixed in PHP in this change :
https://bugs.php.net/bug.php?id=72682

If you look in the change log of the ubuntu packages, the two security fixes were merged into ubuntu in the 5.5.9_4.19 version:
  * SECURITY UPDATE: out of bounds read in exif_process_IFD_in_MAKERNOTE
    - debian/patches/CVE-2016-6291.patch: add more bounds checks to
      ext/exif/exif.c.
    - CVE-2016-6291
  * SECURITY UPDATE: NULL pointer dereference in exif_process_user_comment
    - debian/patches/CVE-2016-6292.patch: properly handle encoding in
      ext/exif/exif.c.
    - CVE-2016-6292

This is where I can only speculate :
I think Ubuntu integrated the security fixes in the PHP version you are using (trusty + security), and with it the regression on EXIF data reading (at the end of Exif data where GPS data is), but didn't integrate the correction of the regression which isn't a "security" fix.
Did your GPS data stop working around July ?

So I'd say, try upgrading your PHP version, if you can, or raising a bug to Ubuntu.

Again, I may be completely wrong :)

Offline

 

#34 2016-12-02 11:10:38

volare
Member
Bavaria
2016-11-13
13

Re: EXIF GPS data not read

Hello wittypluck ,

thanks for all your information , really great . I contacted the hoster concerning that issue .

Beginning of November I uploaded following pictures into gallery , worked fine no problems .
http://beuschel.com/piwigo/index.php?/category/1

Few days later I uploaded
http://beuschel.com/piwigo/index.php?/category/4 , no GPS pos , I made a few manually .

This is the reason I guessed for OSM 2.8.d , the only thing that was changed , I assumed.

greetings

Offline

 

#35 2016-12-02 11:57:36

wittypluck
Member
2016-09-05
24

Re: EXIF GPS data not read

I see the pictures that worked are from a different camera, which could also confirm the issue.

Have you tried stripping the MakerNotes section from the image that doesn't work?
For example with exiftool:
exiftool -makernotes:all= File.jpeg

Offline

 

#36 2016-12-02 12:28:33

volare
Member
Bavaria
2016-11-13
13

Re: EXIF GPS data not read

with SONY
http://beuschel.com/piwigo/picture.php?/303/category/6  , OSM not visible

with Nikkon
http://beuschel.com/piwigo/picture.php?/302/category/6  , OSM visible

When I use i.e. Irfanview GeoHack , both pictures are shown with position map .

Last edited by volare (2016-12-02 12:30:13)

Offline

 

#37 2016-12-02 18:21:40

volare
Member
Bavaria
2016-11-13
13

Re: EXIF GPS data not read

I modified the EXIF data with  pyExifToolGUI (Linux) , removed the makernotes and seems to be fine now .
An modified uploaded pic shows OSM map.
My hoster confirmed , it is a bug in PHP .

greetings

Offline

 

#38 2016-12-03 14:25:09

wittypluck
Member
2016-09-05
24

Re: EXIF GPS data not read

Great!

Offline

 

#39 2017-01-16 21:36:49

zenonz
Member
2017-01-16
3

Re: EXIF GPS data not read

Hi everyone,

I also have issues with GPS data not being read. As I'm a very unskilled person trying to migrate from Menalto Gallery 2 to Piwigo, it's difficult for me to debug anything, but here are following information:

1) GPS data import does not work independently of file type, I tried following:
- RAW files with GPS data in EXIF straight from phone,
- files with lat/long EXIF data added in Menalto Gallery
- files with lat/long and location text in EXIF added in Geosetter

Example photo with GPS data added using Geosetter:
http://mormax.cba.pl/20170115015626-f6b39ecb.jpg

2) output of metadata.php:

Informations are read from 20170115015626-f6b39ecb.jpg

IPTC Fields in 20170115015626-f6b39ecb.jpg

2#000 = 
2#090 = Kędzierzyn-KoŸle
2#092 = Kędzierzyn-KoŸle
2#095 = Opolskie
2#100 = POL
2#101 = Poland


EXIF Fields in 20170115015626-f6b39ecb.jpg

Array
(
    [FileName] => 20170115015626-f6b39ecb.jpg
    [FileDateTime] => 1484443383
    [FileSize] => 214270
    [FileType] => 2
    [MimeType] => image/jpeg
    [SectionsFound] => IFD0
    [COMPUTED] => Array
        (
            [html] => width="900" height="600"
            [Height] => 600
            [Width] => 900
            [IsColor] => 1
            [ByteOrderMotorola] => 0
        )

)

3) when I upload above file to Menalto Gallery 2, GPS data is imported without any issues,

4) Software versions:

Piwigo version

        Piwigo 2.8.5
        Check for upgrade
        Subscribe wkojjnm@jadamspam.pl to Piwigo Announcements Newsletter

Environment

        Operating system: Linux
        PHP: 5.2.17 (Show info) [2017-01-16 21:32:27]
        MySQL: 5.5.5-10.0.28-MariaDB-1.cba [2017-01-16 21:32:27]
        Graphics Library: GD bundled (2.0.34 compatible)

5) local/config/config.inc.php

<?php

/* The file does not exist until some information is entered
below. Once information is entered and saved, the file will be created. */

$conf["show_exif"] = $conf["use_exif"] = true;


?>

I hope that someone has enough time to look at my case,

Thank you in advance.

Offline

 

#40 2017-01-17 14:09:12

eliz82
Member
Romania
2016-04-27
246

Re: EXIF GPS data not read

As you can see in this thread until now they are two solutions:

1) Install minimum PHP 7.0.10 (after you transfer Menalto to Piwigo with the plugin as probably Menalto don't support this version of PHP). If you don't have access to server operating system you need to ask host if is possible.
Some host let you switch PHP version from cpanel, but PHP7 is quite recent not to many host support this yet.
If PHP 7.0.10 is active then go to Piwigo admin panel and re-synchronize.

2) transfer your jpeg files from Piwigo including directories structure to your windows computer, download exiftool, start exiftool in DOS (command prompt) in the directory where you photos and subdirectories are, execute this command to remove makerdata (it will go very fast)
http://piwigo.org/forum/viewtopic.php?p … 55#p164255
copy files back to your Piwigo installation, go to piwigo admin panel and re-synchronize.
if you still want to have LensId in your exif (2.2) then restore the originals (but don't re-synchronize).

zenonz wrote:

I'm a very unskilled person

then bad luck, because this require some low to medium skills. if you try make sure you have backups of files and database.

Offline

 

#41 2017-01-18 12:20:10

zenonz
Member
2017-01-16
3

Re: EXIF GPS data not read

Hi eliz82,

solution 1 is not applicable due to provider.

I tried to apply solution 2, but my photos did not contain maker notes (apart from those test ones that I uploaded directly from mobile).

I don't know if you managed to open example photo, but if you follow this link you'll see that there is not much in EXIF:
http://mormax.cba.pl/piwigo/picture.php?/441/category/2

So it seems that apart from maker notes there are also another reasons for the script not to work. I also re-uploaded Piwigo 2.8.5 files via FTP, but no change.

eliz82 wrote:

then bad luck, because this require some low to medium skills. if you try make sure you have backups of files and database.

By skills I meant understanding of .php and Piwigo files - means I have no clue how to alter any code myself.

Offline

 

#42 2017-01-18 23:08:36

wittypluck
Member
2016-09-05
24

Re: EXIF GPS data not read

Hello zenonz,

I know these GPS issues can be quite frustrating as there are several possible reasons and debugging them is really difficult.
I tried to upload your image in my gallery  (Piwigo 2.8.5) and GPS location works fine so it's not a Piwigo or image issue.
But your PHP version is really old (6 years old !). There have been lots of fixes on the exif data reading in versions since, so I strongly suspect that's the culprit, even if you have no maker notes.

Here's the outuput from your sample file in metadata.php :

Informations are read from sample.jpg


no IPTC information


EXIF Fields in sample.jpg

Array
(
    [FileName] => sample.jpg
    [FileDateTime] => 1484775508
    [FileSize] => 210416
    [FileType] => 2
    [MimeType] => image/jpeg
    [SectionsFound] => ANY_TAG, IFD0, GPS
    [COMPUTED] => Array
        (
            [html] => width="900" height="600"
            [Height] => 600
            [Width] => 900
            [IsColor] => 1
            [ByteOrderMotorola] => 0
        )

    [GPS_IFD_Pointer] => 26
    [GPSVersion] => 
    [GPSLatitudeRef] => N
    [GPSLatitude] => Array
        (
            [0] => 50/1
            [1] => 20/1
            [2] => 377664/10000
        )

    [GPSLongitudeRef] => E
    [GPSLongitude] => Array
        (
            [0] => 18/1
            [1] => 12/1
            [2] => 2275/100
        )

)

Offline

 

#43 2017-01-18 23:27:28

wittypluck
Member
2016-09-05
24

Re: EXIF GPS data not read

You can also try this simple PHP file which will output all Exif data of your image as seen by PHP:

Code:

<?php
$exif = exif_read_data('sample.jpg', 0, true);
echo "sample.jpg:<br />\n";
foreach ($exif as $key => $section) {
    foreach ($section as $name => $val) {
        echo "$key.$name: ";
        print_r($val);
        echo "<br />\n";
    }
}
?>

Output should be for your image :
sample.jpg:
FILE.FileName: sample.jpg
FILE.FileDateTime: 1484775508
FILE.FileSize: 210416
FILE.FileType: 2
FILE.MimeType: image/jpeg
FILE.SectionsFound: ANY_TAG, IFD0, GPS
COMPUTED.html: width="900" height="600"
COMPUTED.Height: 600
COMPUTED.Width: 900
COMPUTED.IsColor: 1
COMPUTED.ByteOrderMotorola: 0
IFD0.GPS_IFD_Pointer: 26
GPS.GPSVersion: 
GPS.GPSLatitudeRef: N
GPS.GPSLatitude: Array ( [0] => 50/1 [1] => 20/1 [2] => 377664/10000 )
GPS.GPSLongitudeRef: E
GPS.GPSLongitude: Array ( [0] => 18/1 [1] => 12/1 [2] => 2275/100 )

Offline

 

#44 2017-01-19 11:25:42

zenonz
Member
2017-01-16
3

Re: EXIF GPS data not read

Hi wittypluck,

I managed to get updated PHP version on the server and geodata works now! So you managed to nail the root cause, thank you!

Now I can continue exploring features of Piwigo before taking final step and migrate fully.

Thanks again!

Offline

 

#45 2017-01-19 13:07:15

wittypluck
Member
2016-09-05
24

Re: EXIF GPS data not read

Great ! Have fun with Piwigo..

Offline

 

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2019 · Contact