function media_flickr_record_photo in Media: Flickr 6
Record any associated metadata with a specific photo.
Parameters
$id: The Photo ID from Flickr. @param $options Reserved for future use. Contains instanciated node information, etc.
2 calls to media_flickr_record_photo()
- media_flickr_record_photoset in ./
media_flickr.module - Record the photoset and all its photos.
- _media_flickr_photoset_load_photos in ./
media_flickr.utilities.inc - Returns an array of all URLs for photos associated with a photoset, associated by photo code. These will be of the Flickr specified size (1-5), and may be local or remote, based on settings and availability.
File
- ./
media_flickr.module, line 275 - Embedded Video Field provider file for Flickr.com photosets.
Code
function media_flickr_record_photo($id, $options = array()) {
$instances = db_result(db_query("SELECT COUNT(*) FROM {media_flickr} WHERE code = '%s'", $id));
// If the photo already exists, then we'll update the metadata in the db.
$update = $instances ? array(
'code',
) : array();
// Load the metadata from the Flickr XML.
$photo = media_flickr_photo_load($id);
// Write any metadata associated with an individual photo.
$record = array(
'code' => $id,
'title' => $photo['photo']['title']['_content'],
'owner' => $photo['photo']['owner']['username'],
'description' => $photo['photo']['description']['_content'],
'url' => $photo['photo']['urls']['url'][0]['_content'],
);
drupal_write_record('media_flickr', $record, $update);
// @TODO: record each instance per node.
// This is stored in the $options array, but not currently used.
}