Closed hcmh closed 10 years ago
Hello,
EXIF data for PNG file format does not exist. That is why there is filter on jpeg or jpg files. http://stackoverflow.com/questions/19492969/how-can-i-extract-gps-exif-info-from-a-png http://stackoverflow.com/questions/9542359/does-png-contain-exif-data-like-jpg
Also as part of PWG2.6, EXIF information are read directly by PWG core. So there is no more code to read EXIF data in the latest version v2.6a, https://github.com/xbgmsharp/piwigo-openstreetmap/releases.
However, openstreetmaps extension allow you to set an GPS information directly in PWG via the photo-edit page.
In any case, if you have PNG file with GPS information, I could add support for it. You will need to provide me sample and a tool to read it.
That is very interesting, I did not know that there isn't a standard way to write EXIF to PNG.
Here, for example, is a sample image with metadata (created by digikam http://digikam.org/). ExifTool (http://en.wikipedia.org/wiki/ExifTool) seems to find exif data embeded in the image (with 'exiftool -a -EXIF:all'), and 'exiftool -a -gps:all' finds GPS information: GPS Version ID : 2.0.0.0 GPS Latitude Ref : North GPS Latitude : 59 deg 58' 0.85" GPS Longitude Ref : East GPS Longitude : 10 deg 40' 26.43" GPS Altitude Ref : Above Sea Level GPS Altitude : 405.6 m GPS Map Datum : WGS-84
But, since this is an external Perl program, I am not sure if it can be used for this extension. In any case, it is not much work to just convert to .jpeg before uploading.
Thank you for your time!
In fact the limitation is not in PWG but in the PHP function probably due to the lack of standard. http://www.php.net/manual/en/function.exif-read-data.php
However I found a way to read the PNG metadata using your sample: http://www.php.net/manual/en/imagick.getimageproperties.php
exif:GPSAltitude => 2028/5
exif:GPSAltitudeRef => 0
exif:GPSInfo => 10918
exif:GPSLatitude => 59/1, 58/1, 4462/5269
exif:GPSLatitudeRef => N
exif:GPSLongitude => 10/1, 40/1, 74875/2833
exif:GPSLongitudeRef => E
exif:GPSMapDatum => WGS-84
exif:GPSVersionID => 2, 0, 0, 0
As the GPS sync in now part of PWG core, you can create a request on the forum. http://piwigo.org/forum/viewforum.php?id=13
It is not too complex to use imagick if file ext is PNG for the GPS sync.
$exif = @read_exif_data($filename);
if (!is_array($exif))
{
/* Create the object */
$im = new imagick($filename);
/* Get the EXIF information */
$exifArray = $im->getImageProperties("exif:*");
/* Loop trough the EXIF properties */
foreach ($exifArray as $name => $property)
{
$key = preg_split("/:/", $name);
$exif[$key[1]] = $property;
}
}
I might provide a patch to PWG team for support PNG EXIF data. Anyway it is not anymore in the plugin so closing.
Hello,
I noticed the following pattern in my test of the openstreetmaps extension: It seems like location information is only found for .jpeg images, not for the .png images I uploaded.
Is it possible that this plugin does not read exif loction information from .png's?
Thank you so much for your work on this extension!