Subversion Repositories eFlore/Applications.cel

Rev

Rev 2459 | Rev 3534 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2459 Rev 2460
Line 1... Line 1...
1
<?php
1
<?php
-
 
2
// declare(encoding='UTF-8');
2
/**
3
/**
3
 * Classe d'extraction de metadonnées afin de les mettre dans
4
 * Classe d'extraction de metadonnées d'un fichier JPEG afin de les mettre dans un tableau au format du CEL.
4
 * un tableau au format du cel
-
 
5
 * Encodage en entrée : utf8
-
 
6
 * Encodage en sortie : utf8
-
 
7
 *
5
 *
-
 
6
 * @internal   Mininum PHP version : 5.2
-
 
7
 * @category   CEL
-
 
8
 * @package    Services
-
 
9
 * @subpackage Bibliothèques
-
 
10
 * @version    0.1
8
 * @author Aurélien PERONNET <aurelien@tela-botanica.org>
11
 * @author     Mathias CHOUET <mathias@tela-botanica.org>
9
 * @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
12
 * @author     Jean-Pascal MILCENT <jpm@tela-botanica.org>
-
 
13
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
10
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
14
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
11
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
15
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
12
 * @version $Id$
-
 
13
 * @copyright © 2012, Tela Botanica
16
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
14
 */
17
 */
15
class ExtracteurMetadonnees {
18
class ExtracteurMetadonnees {
Line 16... Line 19...
16
 
19
 
17
	private $meta = array();
20
	private $meta = array();
Line 532... Line 535...
532
    	return $tableau_exif_formate;
535
		return $tableau_exif_formate;
533
    }
536
	}
Line 534... Line 537...
534
 
537
 
535
    /**
538
	/**
536
    * Extraction des metadonnées iptc
539
	 * Extraction des metadonnées iptc
537
    **/
540
	 */
538
    public function extraireIptc($chemin_fichier) {
541
	public function extraireIptc($chemin_fichier) {
Line 539... Line 542...
539
    	$meta = array();
542
		$meta = array();
540
 
543
 
541
        // getimagesize renvoie les infos iptc dans le tableau info
544
		// getimagesize renvoie les infos iptc dans le tableau info
Line 542... Line 545...
542
        $info = array();
545
		$info = array();
543
        $size = getimagesize($chemin_fichier, $info);
546
		$size = getimagesize($chemin_fichier, $info);
544
 
547
 
545
        // s'il existe
548
		// s'il existe
546
        if (isset($info["APP13"])) {
549
		if (isset($info['APP13'])) {
547
            // on parse les donnees
550
			// on parse les donnees
548
            $iptc = iptcparse($info["APP13"]);
551
			$iptc = iptcparse($info['APP13']);
549
            if ($iptc) {
552
			if ($iptc) {
550
                // et on les analyse
553
				// et on les analyse
551
                foreach ($iptc as $marker => $section) {
554
				foreach ($iptc as $marker => $section) {
552
                    foreach ($section as $nom => $val) {
555
					foreach ($section as $nom => $val) {
553
                        // pour remplir le tableau de donnees
556
						// pour remplir le tableau de donnees
554
                        $this->decoderValeurIptc($marker, $val, $meta);
557
						$this->decoderValeurIptc($marker, $val, $meta);
555
                    }
558
					}
556
                }
-
 
557
            }
559
				}
558
        }
560
			}
Line 559... Line 561...
559
 
561
		}
560
        return $meta;
562
		return $meta;
Line 647... Line 649...
647
    		$xml .= "</$racine>";
649
			$xml .= "</$racine>";
648
    	}
650
		}
649
    	return $xml;
651
		return $xml;
650
    }
652
	}
651
}
653
}
652
?>
-
 
653
654