saving longitude and latitude etc…
-
i’ve been following this post which tells you how to get add more meta data from your images’ exif data.
I’m trying to add longitude and lat – the below nearly works and adds the metadata fields into the table _postmeta but the values are empty.
i’m not sure how to express the $file variable in add_filter(‘wp_read_image_metadata’, ‘add_geo_exif’ );
the post says to use
add_filter(‘wp_read_image_metadata’, ‘add_geo_exif’, , 3); but that doesn’t work?(placed in the templates’ functions.php)
add_geo_exif($meta,$file,$sourceImageType) { list(,,$sourceImageType) = getimagesize( $file ); $exif = exif_read_data( $file ); $meta['latitude'] = $exif['GPSLatitude'] ; $meta['latitude_ref'] = trim( $exif['GPSLatitudeRef'] ); $meta['longitude'] = $exif['GPSLongitude'] ; $meta['longitude_ref'] = trim( $exif['GPSLongitudeRef'] ); return $meta; } add_filter('wp_read_image_metadata', 'add_geo_exif');
any help much appreciated!
- The topic ‘saving longitude and latitude etc…’ is closed to new replies.