All pastes #752121 Raw Edit

Unnamed

public text v1 · immutable
#752121 ·published 2007-10-28 01:43 UTC
rendered paste body
//here I am pulling values from an xml document and storing them in the data array

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['TITLE'][0];
  $data['subtitle'] = $xml['SUBTITLE'][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];

  return $data;
}

//what I need to actually return here is the value of $data['original'], which is a url, instead it prints 5, which is the array number.

function image_ncck_picasa_image_url($code, $data) {
if($data['original'] ){
  return $data['original'];
  }
}