You are here

function image_ncck_picasa_data in Embedded Media Field 5

File

contrib/image_ncck/providers/picasa.inc, line 46

Code

function image_ncck_picasa_data($field, $item) {
  $data = array();
  if (preg_match('!picasaweb\\.google\\.com/([^/]*)/([^/]*)/photo\\#(.*)!i', $item['embed'], $matches)) {
    $data = array(
      'userid' => $matches[1],
      'album' => $matches[2],
      'photoid' => $matches[3],
    );
  }

  // use the page id, since we'll have that in most cases (except in embed pastes, which gets parsed during extraction)
  // we use this to get an rss feed w/ all the info for the image. interesting reading ;)
  $xml = image_ncck_picasa_request($data, 'tag');
  $data['title'] = $xml['MEDIA:GROUP']['MEDIA:DESCRIPTION'][0];
  $data['original'] = $xml['MEDIA:GROUP']['MEDIA:CONTENT'][1][URL];
  $data['small'] = $xml['MEDIA:GROUP']['MEDIA:THUMBNAIL'][1][URL];
  $data['medium'] = $xml['MEDIA:GROUP']['MEDIA:THUMBNAIL'][3][URL];
  $data['large'] = $xml['MEDIA:GROUP']['MEDIA:THUMBNAIL'][5][URL];
  $data['width'] = $xml['MEDIA:GROUP']['MEDIA:THUMBNAIL'][5][WIDTH];
  $data['height'] = $xml['MEDIA:GROUP']['MEDIA:THUMBNAIL'][5][HEIGHT];
  return $data;
}