You are here

function _emimage_imageshack_scrape_image_url in Embedded Media Field 6

Same name and namespace in other branches
  1. 6.3 contrib/emimage/providers/imageshack.inc \_emimage_imageshack_scrape_image_url()

Scrape the actual image URL from the ImageShack page.

Parameters

String $url: ImageShack page.

Return value

String ImageShack image URL.

1 call to _emimage_imageshack_scrape_image_url()
emimage_imageshack_data in contrib/emimage/providers/imageshack.inc

File

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

Code

function _emimage_imageshack_scrape_image_url($url) {
  static $urls;
  if (isset($urls[$url])) {
    return $urls[$url];
  }
  $request = drupal_http_request($url);
  if ($html = $request->data) {
    if (preg_match('!<img id="thepic" .+? src="(.+?)"!is', $html, $matches)) {
      return $urls[$url] = $matches[1];
    }
  }
}