function emimage_flickr_data in Embedded Media Field 6
1 call to emimage_flickr_data()
- emimage_flickr_import in contrib/emimage/providers/flickr.inc
- This allows flickr photosets to be imported into nodes
File
- contrib/emimage/providers/flickr.inc, line 137
- This include processes flickr.com image files for use by emfield.module.
Code
function emimage_flickr_data($field, $item) {
$data = array();
$xml = emimage_flickr_request('flickr.photos.getInfo', array(
'photo_id' => $item['value'],
));
$data['owner'] = $xml['photo']['owner']['nsid'];
$data['title'] = $xml['photo']['title']['_content'];
$data['description'] = $xml['photo']['description']['_content'];
$data['tags'] = array();
if (is_array($xml['photo']['tags']['tag'])) {
foreach ($xml['photo']['tags']['tag'] as $tag) {
$data['tags'][] = $tag['raw'];
}
}
$width = 0;
$height = 0;
$xml = emimage_flickr_request('flickr.photos.getSizes', array(
'photo_id' => $item['value'],
));
foreach ($xml["sizes"]["size"] as $size) {
if ($size["label"] != "Square") {
if ((int) $size["width"] > $width) {
$width = (int) $size["width"];
$height = (int) $size["height"];
}
}
}
if ($width > 0) {
$data['width'] = $width;
$data['height'] = $height;
}
$data['emimage_data_version'] = EMIMAGE_FLICKR_DATA_VERSION;
return $data;
}