Had no issues using Emfield 6.x-1.7 for a long time. Yesterday, however, all Dailymotion thumbnails stopped working.

Comments

HS’s picture

Category: support » bug
perpignan’s picture

Version: 6.x-1.7 » 6.x-2.5

To have the good path of the thumbnail, the thing is to extract the path from http://www.dailymotion.com/api/oembed?url=http://www.dailymotion.com/vid...

Example :
$id="VideoID";
$xml=simplexml_load_file("http://www.dailymotion.com/api/oembed?url=http://www.dailymotion.com/video/".$id."&format=xml");
if($xml) {
$xml->thumbnail_url;
}

perpignan’s picture

To have the correct path, i do on module media_video_flotsam, in the file providers/dailymotion.inc
line 125 :
function emvideo_dailymotion_thumbnail($field, $item, $formatter, $node, $width, $height) {

$xml=simplexml_load_file("http://www.dailymotion.com/api/oembed?url=http://www.dailymotion.com/video/".$item['value']."&format=xml");
if($xml) {
return $xml->thumbnail_url;
}
}

HS’s picture

Version: 6.x-2.5 » 6.x-1.7

I'm experiencing this on 6.x-1.7 are you experiencing this on 2.5 as well?

HS’s picture

This is the current code,

function emvideo_dailymotion_thumbnail($field, $item, $formatter, $node, $width, $height) {
  return 'http://www.dailymotion.com/thumbnail/160x120/video/'. $item['value'];
}

How do I change that? Thank you for the help!

perpignan’s picture

Version: 6.x-1.7 » 6.x-2.5

I change this code

function emvideo_dailymotion_thumbnail($field, $item, $formatter, $node, $width, $height) {
  return 'http://www.dailymotion.com/thumbnail/160x120/video/'. $item['value'];
}

To this :

function emvideo_dailymotion_thumbnail($field, $item, $formatter, $node, $width, $height) {
    $xml=simplexml_load_file("http://www.dailymotion.com/api/oembed?url=http://www.dailymotion.com/video/".$item['value']."&format=xml");
     if($xml) {
           return $xml->thumbnail_url;
    }
}

Perhaps, it's not the better thing to do... But it's working now ! :)

HS’s picture

Thanks for replying. I tried that and it replaced the thumbs for all DM videos with my specified default thumbnail.

HS’s picture

Seeing the following in my logs after making your change,

simplexml_load_file(http://www.dailymotion.com/api/oembed?url=http://www.dailymotion.com/vid...) [function.simplexml-load-file]: failed to open stream: no suitable wrapper could be found in /homepages/8/d113692726/htdocs/Domains/...../sites/all/modules/emfield/contrib/emvideo/providers/dailymotion.inc on line 126.

simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://www.dailymotion.com/api/oembed?url=http://www.dailymotion.com/vid... in /homepages/8/d113692726/htdocs/Domains/..../sites/all/modules/emfield/contrib/emvideo/providers/dailymotion.inc on line 126.

perpignan’s picture

It's because in your php.ini, you surely have "allow_url_fopen" at "Off", you can change value to "On" to allow open an external url.

HS’s picture

I don't see that setting in my php.ini file? How do I add it? Thank you for your help!

I'm using PHP 5

HS’s picture

isn't enabling 'allow_url_fopen' opening your self to security vulnerabilities? I hear Curl is a better method?

HS’s picture

Is there a version of Emfield I can safely upgrade to from version 6.x-1.7, where I don't need to hack the code?

Edit: Just noticed that all versions have this issue.

Youpinadi’s picture

There has been a regression in the thumbnail code, we fixed it and it is now live. Sorry for the convenience.
The good way to access a dailymotion thumbnail is: http://www.dailymotion.com/thumbnail/160x120/video/[ID] (this url redirects directly to our cdn)

Youpinadi’s picture

BBaptiste’s picture

Status: Active » Closed (won't fix)

It works again !
Thank for this fixes.

HS’s picture

Status: Closed (won't fix) » Active

Received the email below from the DM team today (Thank you to Youpinadi) but still doesnt work.

See this thumbnail, for example: http://www.dailymotion.com/thumbnail/160x120/video/xlp7q4

Hi,
There has been a regression in the thumbnail code, we fixed it and it is now live. Sorry for the convenience.
The good way to access a dailymotion thumbnail is: http://www.dailymotion.com/thumbnail/160x120/video/[ID] (this url redirects directly to our cdn)

Regards
Dailymotion team

HS’s picture

Status: Active » Closed (fixed)

Thanks DailyMotion team, it works now.

attackattack’s picture

Issue summary: View changes