You are here

function emimage_picasa_image_url in Embedded Media Field 6.3

Same name and namespace in other branches
  1. 6 contrib/emimage/providers/picasa.inc \emimage_picasa_image_url()

Implement emimage_PROVIDER_image_url.

Parameters

$code: the code of the image

$data: any stored data for the image, which may already have the url of the image to display

Return value

the url directly to emfield for the image to display

File

contrib/emimage/providers/picasa.inc, line 139
This include processes picasa.com image files for use by emfield.module.

Code

function emimage_picasa_image_url($code, $width, $height, $formatter, $field, $item, $node) {
  if (func_num_args() == 7) {
    $arg = func_get_arg(5);
    $code =& $arg['data']['original'];
    $data =& $arg['data'];
    $size = _emimage_picasa_guess_size($width, $height);
  }

  //http://lh5.google.com/kaos777/RwqRRgxcKrI/AAAAAAAAAB0/pl5FboT6x2M/IMG_0468.JPG
  if (preg_match('!([^/]*)\\.ggpht\\.com/([^/]*)/([^/]*)/([^/]*)/([^/]*)/(.*)!i', $code, $matches)) {
    $info = array(
      'server' => $matches[1],
      'userid' => $matches[2],
      's1' => $matches[3],
      's2' => $matches[4],
      's3' => $matches[5],
      'image' => $matches[6],
    );
  }
  return "http://{$info['server']}.google.com/{$info['userid']}/{$info['s1']}/{$info['s2']}/{$info['s3']}/s{$size}/{$info['image']}";
}