For both thumbnail and full-node views, I'm getting the following errors with emfield-5.x-1.2 and Drupal Core 5.10:

warning: file_get_contents(http://s289.photobucket.com/albums/ll218/Rblue93yj/?action=view&current=...) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/theunpav/public_html/jjusa/modules/emfield/contrib/image_ncck/providers/photobucket.inc on line 118.

and

warning: file_get_contents(http://s289.photobucket.com/albums/ll218/Rblue93yj/?action=view&current=...) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/theunpav/public_html/jjusa/modules/emfield/contrib/image_ncck/providers/photobucket.inc on line 118.

Seems like this error gets thrown when Photobucket can't find the image... I also see "This image for video has been deleted or removed" placeholder displayed by Photobucket on my full-node View.

Any ideas how to fix this error?

I found a related thread at http://drupal.org/node/210191 which covers Picasa module, so perhaps a similar fix could be found for Embedded Media Field as well?

Comments

aaron’s picture

Priority: Normal » Critical

Hmmm... We could use the cURL option, although that would require that library to be installed (which it may not be on many hosts). Would probably be better to use @file_get_contents. Can you try adding that on line 118 and testing? I'll put that in the next time I work on the module, but probably won't have time to test it right away. Setting to critical to remind myself, as it's easy enough to fix, if that solution works.

krisvannest’s picture

Would be glad to test, but I'm a little out of my league programming-wise so would need some guidance... here's the code for lines #112-#120 as found in modules/emfield/contrib/image_ncck/providers/photobucket.inc:

function _image_ncck_photobucket_scrape_image_title($url) {
  static $title;
  if (isset($title[$url])) {
    return $title[$url];
  }

  $html = file_get_contents($url);
  return $title[$url] = preg_match('@<span id="photoTitle">(.+?)</span>@is', $html, $matches)? $matches[1] : '';
}

So just let know if you want me to replace the $html = file_get_contents($url); in line #118 with $html = @file_get_contents($url); (basically add an "@" there) and I'll test it out, but I wasn't sure if that's all I would have to change, etc?

Thx KV

PHP NOOB’s picture

PHP NOOB’s picture

i'm not familair with using @ from my experience. so i cant help you there

but, all cases of a forward slash while using preg_match or preg_match_all have to be prefixed with a back slash or
you end up with "unknown modifier"


function _image_ncck_photobucket_scrape_image_title($url) {
  static $title;
  if (isset($title[$url])) {
    return $title[$url];
  }

  $html = file_get_contents($url);
  return $title[$url] = preg_match('@<span id="photoTitle">(.+?)<\/span>@is', $html, $matches)? $matches[1] : '';
}

i believe you already answered your problem:

quote "Seems like this error gets thrown when Photobucket can't find the image... I also see "This image for video has been deleted or removed" placeholder displayed by Photobucket on my full-node View."

jtjones23’s picture

Version: 5.x-1.2 » 5.x-1.3

I'm getting the same error as krisvannest using 5.x-1.3. But, I only get this error when attempting to add multiple images to one page. If I uncheck multiple values, the photobucket image displays just fine.

--John

Drupal 5.16
PHP 5.2.9

jtjones23’s picture

Version: 5.x-1.3 » 5.x-1.9

Still getting this error..any ideas?