diff --git a/.gitignore b/.gitignore
index 6985fb1..45dd7eb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
/.settings
/.buildpath
/.project
+/-child
diff --git a/functions.php b/functions.php
index e52f1cd..c438926 100644
--- a/functions.php
+++ b/functions.php
@@ -385,8 +385,73 @@ function date_archive ($chaine) {
function flickr_handler($atts, $content=null) {
- // flickr = pas d'exifs
+ global $coord;
+ $api_key = "3884af4190ac97a95fd4777dba0d9f21";
+
+ extract(shortcode_atts(array(
+ "pid" => $atts[0],
+ "version"=>"Medium 800", //setting default value
+ "caption"=>"", //setting default value
+ "url"=>""
+ ), $atts));
+ if($url != ""){
+ $e=explode("/",$url);
+ $pid=$e[5];
+ }
+
+//echo $pid . " - ". $version . " - ". $caption . " - ". $url . "
";
+// 27868468454 - Medium - - https://www.flickr.com/photos/funnymac/27868468454/
+
+/*
+[flickr url="https://www.flickr.com/photos/funnymac/27868468454/"]
+
+[flickr pid="27868468454"]
+
+[flickr pid="27868468454" version="Small"]
+*/
+
+ switch (strtolower($version)) {
+ case "square":
+ $img_sd = "Square";
+ $img_hd = "Large Square";
+ break;
+ case "large square":
+ $img_sd = "Square";
+ $img_hd = "Large Square";
+ break;
+ case "small":
+ $img_sd = "Small";
+ $img_hd = "Medium";
+ break;
+ case "small 320":
+ $img_sd = "Small 320";
+ $img_hd = "Medium 640";
+ break;
+ case "medium":
+ $img_sd = "Medium";
+ $img_hd = "Large";
+ break;
+ case "medium 640":
+ $img_sd = "Small 320";
+ $img_hd = "Medium 640";
+ break;
+ case "medium 800":
+ $img_sd = "Medium 800";
+ $img_hd = "Large 1600";
+ break;
+ case "large":
+ $img_sd = "Medium";
+ $img_hd = "Large";
+ break;
+ case "large 1600":
+ $img_sd = "Medium 800";
+ $img_hd = "Large 1600";
+ break;
+}
+
+//echo $img_sd . " - ". $img_hd . "
";
+/*
$link = ! empty( $atts['link'] ) ? $atts['link'] : '';
$link = filter_var($link, FILTER_SANITIZE_URL);
@@ -407,33 +472,161 @@ function flickr_handler($atts, $content=null) {
$lb = ! empty( $atts['lb'] ) ? $atts['lb'] : '';
$lb = filter_var($lb, FILTER_SANITIZE_STRING);
$info = array();
+*/
+
// 1220 -610
$lb = toBool($lb);
$rnd = rand (1000, 9999);
$selector = dess_setting('dess_lightbox_select');
- $flickr_size = getimagesize(htmlentities($small), $info);
- if (isset($info["APP13"])) {
- $iptc = iptcparse($info["APP13"]);
- //var_dump($iptc);
- }
- //else echo "no info !!";
- $links = (($caption != "") ? '
' : '');
- $links .= '
';
- $links .= '';
- $links .= '';
- //$link .= '';
- $links .= '';
- $links .= '';
- $links .= '';
- $links .= '';
- $links .= '
';
- $links .= '';
+ $url1 = 'https://api.flickr.com/services/rest/?method=flickr.photos.getSizes';
+ $url1 .= '&api_key='.$api_key;
+ $url1 .= '&photo_id='.$pid;
+ $url1 .= '&format=json';
+ $url1 .= '&nojsoncallback=1';
+
+ $result = file_get_contents($url1);
+ $response = json_decode($result, true);
+ //preprint($response);
+ $taille = $response['sizes']['size'];
+
+ foreach ($taille as $val) {
+ if ($val['label'] == $img_sd) {
+ $mediumSRC = $val['source'];
+ $w_mediumSRC = $val['width'];
+ $h_mediumSRC = $val['height'];
+ }
+ if ($val['label'] == $img_hd) {
+ $largeSRC = $val['source'];
+ $w_largeSRC = $val['width'];
+ $h_largeSRC = $val['height'];
+ }
+ }
+
+ /* Info de l'image */
+
+ $url2 = 'https://api.flickr.com/services/rest/?method=flickr.photos.getInfo';
+ $url2 .= '&api_key='.$api_key;
+ $url2 .= '&photo_id='.$pid;
+ $url2 .= '&format=json';
+ $url2 .= '&nojsoncallback=1';
+
+ $result2 = file_get_contents($url2);
+ $response2 = json_decode($result2, true);
+ //var_dump($response2);
+
+ $title = $response2['photo']['title']['_content'];
+ $date = $response2['photo']['dates']['taken'];
+ $lat = $response2['photo']['location']['latitude'];
+ $long = $response2['photo']['location']['longitude'];
+ $tag = $response2['photo']['tags']['tag'];
+ $desc = $response2['photo']['description']['_content'];
+ $copy = $response2['photo']['owner']['username'];
+
+ $tags = array();
+ foreach ($tag as $val) {
+ //$i = $val['_content'];
+ $i = $val['raw'];
+ $tags[] = utf8_encode(ucfirst($i));
+ }
+
+ $img = array(
+ 'medium' => $mediumSRC,
+ 'large' => $largeSRC
+ //'titre' => $title,
+ //'date' => $date,
+ //'latitude' => $lat,
+ //'longitude' => $long,
+ //'tags' => $tags
+ );
+
+ /* EXIF */
+
+ $url3 = 'https://api.flickr.com/services/rest/?method=flickr.photos.getExif';
+ $url3 .= '&api_key='.$api_key;
+ $url3 .= '&photo_id='.$pid;
+ $url3 .= '&format=json';
+ $url3 .= '&nojsoncallback=1';
+
+ $result3 = file_get_contents($url3);
+ $response3 = json_decode($result3, true);
+
+ $exif = $response3['photo']['exif'];
+ //preprint($exif);
+
+ $meta = array();
+ foreach ($exif as $val) {
+ //preprint($val);
+
+ if ($val['tag'] == 'FNumber') $meta['aperture'] = $val['raw']['_content'];
+ //if ($val['tag'] == 'xxx') $meta['credit'] = $val['raw']['_content'];
+ $meta['credit'] = $copy;
+ if ($val['tag'] == 'Model') $meta['camera'] = $val['raw']['_content'];
+ //if ($val['tag'] == 'xxx') $meta['caption'] = $val['raw']['_content'];
+ if ($val['tag'] == 'DateTimeOriginal') $meta['created_timestamp'] = strtotime($val['raw']['_content']);
+ //if ($val['tag'] == 'xxx') $meta['copyright'] = $val['raw']['_content'];
+ if ($val['tag'] == 'FocalLength') $meta['focal_length'] = $val['raw']['_content'];
+ if ($val['tag'] == 'ISO') $meta['iso'] = $val['raw']['_content'];
+ if ($val['tag'] == 'ExposureTime') $meta['shutter_speed'] = $val['raw']['_content'];
+ //if ($val['tag'] == 'xxx') $meta['title'] = $val['raw']['_content'];
+ $meta['title'] = $title;
+ if ($val['tag'] == 'Orientation') $meta['orientation'] = $val['raw']['_content'];
+ $meta['latitude'] = $lat;
+ $meta['longitude'] = $long;
+ $meta['keywords'] = $tags;
+ //$meta['latitudeRef']
+ //$meta['longitudeRef']
+ //$meta['altitude']
+ $meta['medium'] = $mediumSRC;
+ $meta['large'] = $largeSRC;
+
+ }
+
+ //preprint($exifs);
+/*
+ $meta = zp_query_exif( $zp_image );
+ $exif_array = img_wp_exif( $meta );
+ $exifs = "
" . $exif_array[0] . (($display_gps == true) ? $exif_array[2] : '') . "
";
+*/
+ //$meta = zp_query_exif( $zp_image ); //745 $meta['keywords'] =>
+ $exif_array = img_wp_exif( $meta ); //1214
+ //echo "exif_array";
+ //preprint($exif_array);
+
+
+ $links = (($caption != "") ? '
' : '');
+
+ $links .= "
" . $exif_array[0] . (($display_gps == true) ? $exif_array[2] : '') . "
";
+
+/*
+ $exif_array = img_wp_exif( $meta );
+ $exifs = "
" . $exif_array[0] . (($display_gps == true) ? $exif_array[2] : '') . "
";
+ $content = str_replace($matches[$i][0], $matches[$i][0] . $exifs, $content);
+ $matches2 = array();
+*/
+ if (($meta['longitude'] != "") && ($meta['latitude'] != "")) {
+ if ($meta['caption'] != "") $fichier = $meta['caption'];
+ else if ($meta['title'] != "") $fichier = $meta['title'];
+ //else $fichier = end(explode("/", $court));
+ array_push($coord, array($meta['latitude'], $meta['longitude'], $fichier));
+ }
+
return $links;
}
@@ -715,7 +908,7 @@ Array
}
$meta['keywords'] = $tags;
}
-
+ //preprint($meta);
return $meta;
}
@@ -1001,7 +1194,7 @@ xdebug_start_trace('/Users/bruno/Sites', XDEBUG_TRACE_COMPUTERIZED);
// Autres sources que WP et ZP
elseif (substr_count($ancien, 'jpg') > 0) {
- echo "court2: " . $court . "
";
+ //echo "court2: " . $court . "
";
$meta = creator_get_exif( $court );
//$flk_size = getimagesize(htmlentities($filename3));
/*
@@ -1041,7 +1234,7 @@ add_action('the_content','addexif');
function img_wp_exif( $exif_array ) {
-
+//preprint($exif_array);
/*
Array
(
diff --git a/single.php b/single.php
index 33a7e1c..d014c22 100755
--- a/single.php
+++ b/single.php
@@ -16,10 +16,14 @@ get_header();
0) ? "block" : "none") . ';">
'; ?>
+
+