source: extensions/AMetaData/amd_jpegmetadata.class.inc.php @ 14092

Last change on this file since 14092 was 5790, checked in by grum, 15 years ago

Add some GPS functionnalities

File size: 2.5 KB
RevLine 
[5790]1<?php
2/*
3 * -----------------------------------------------------------------------------
4 * Plugin Name: Advanced MetaData
5 * -----------------------------------------------------------------------------
6 * Author     : Grum
7 *   email    : grum@piwigo.org
8 *   website  : http://photos.grum.fr
9 *   PWG user : http://forum.piwigo.org/profile.php?id=3706
10 *
11 *   << May the Little SpaceFrog be with you ! >>
12 *
13 * -----------------------------------------------------------------------------
14 *
15 * See main.inc.php for release information
16 *
17 * This file contains the AMD_JpegMetaData class, overriding the JpegMetaData
18 * class
19 *
20 * See the JpegMetaData class to obtain more information about the provided
21 * functions
22 *
23 * -----------------------------------------------------------------------------
24 */
25
26  include_once('JpegMetaData/JpegMetaData.class.php');
27
28  class AMD_JpegMetaData extends JpegMetaData
29  {
30    static public function getTagList($options=Array())
31    {
32      $returned=parent::getTagList($options);
33
34      $returned['magic.GPS.GoogleMaps']=Array(
35        'implemented' => true,
36        'translatable' => true,
37        'name' => "magic.GPS.GoogleMaps"
38      );
39
40      ksort($returned);
41      return($returned);
42    }
43
44
45    function __construct($file = "", $options = Array())
46    {
47      parent::__construct($file, $options);
48    }
49
50    function __destruct()
51    {
52      parent::__destruct();
53    }
54
55    /**
56     * MagicTags are build with this function
57     */
58    protected function processMagicTags()
59    {
60      parent::processMagicTags();
61      // process tag "magic.GPS.GoogleMaps"
62      if(array_key_exists("magic.GPS.LatitudeNum", $this->tags) and
63         array_key_exists("magic.GPS.LongitudeNum", $this->tags))
64      {
65        $tag=new Tag("magic.GPS.GoogleMaps",0,"magic.GPS.GoogleMaps");
66
67        $tag->setValue("http://maps.google.com/maps?oe=UTF8&ll=".trim($this->tags['magic.GPS.LatitudeNum']->getLabel()).",".trim($this->tags['magic.GPS.LongitudeNum']->getLabel())."&t=k&z=15");
68        $tag->setLabel("<a href='http://maps.google.com/maps?oe=UTF8&ll=".trim($this->tags['magic.GPS.LatitudeNum']->getValue()).",".trim($this->tags['magic.GPS.LongitudeNum']->getValue())."&t=k&z=15'>|".$this->tags['magic.GPS.Localization']->getLabel()."|</a>");
69        $tag->setKnown(true);
70        $tag->setImplemented(true);
71        $tag->setTranslatable(true);
72
73        $this->tags["magic.GPS.GoogleMaps"]=$tag;
74
75        unset($tag);
76      }
77    }
78
79  } // class AMD_JpegMetaData
80
81?>
Note: See TracBrowser for help on using the repository browser.