Jest taka modyfikacja jak Video System
Posiada on możliwość dodawania filmów z youtube i Vimeo Video.
Teraz moje pytanie. Co zrobić by dodawał też z megavideo ?
w admin/applications_addon/other/videos/sources/thumbnail_sites/. znajduję się tylko pliki youtube i vimeo video
Zawartość pliku youtube wygląda następująco:
<?php
/*
+--------------------------------------------------------------------------
| (M31) Videos System 2.0.2
| =============================================
| by Michael
| Copyright 2007-2010 DevFuse
| http://www.devfuse.com
| =============================================
} Youtube thumbnail plugin
+--------------------------------------------------------------------------
*/
if( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit;
}
class thumbnail_youtube extends ipsCommand
{
public function doExecute( ipsRegistry $registry )
{
}
public function getMediaThumbnail( $content )
{
# Get the id of incoming media bbcode url
$match = preg_replace( "#{[0-9]}#", "(.*?)", str_replace( '.', '\.', str_replace( '?', '\?', "http://(|www.)youtube.com/watch?v={2}" ) ) );
$replace = "$2";
$video_id = preg_replace( "#^" . $match . "$#is", $replace, $content );
# Youtube video id is only 11 chars.
$video_id = substr( $video_id, 0, 11 );
$video['id'] = $video_id;
# Return url to thumbnail so image can be downloaded.
$video['url'] = "http://i2.ytimg.com/vi/{$video_id}/default.jpg";
return $video;
}
}
?>
Kod vimeo:
<?php
/*
+--------------------------------------------------------------------------
| (M31) Videos System 2.0.2
| =============================================
| by Michael
| Copyright 2007-2010 DevFuse
| http://www.devfuse.com
| =============================================
} Vimeo thumbnail plugin
+--------------------------------------------------------------------------
*/
if( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit;
}
class thumbnail_vimeo extends ipsCommand
{
public function doExecute( ipsRegistry $registry )
{
}
public function getMediaThumbnail( $content )
{
# Get the id of incoming media bbcode url
$match = preg_replace( "#{[0-9]}#", "(.*?)", str_replace( '.', '\.', "http://(|www.)vimeo.com/{2}" ) );
$replace = "$2";
$video_id = preg_replace( "#^" . $match . "$#is", $replace, $content );
$thumbnail_url = "http://vimeo.com/api/v2/video/{$video_id}.php";
if( !$image_data = @file_get_contents( $thumbnail_url ) )
{
if ( function_exists("curl_init") AND function_exists("curl_exec") )
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $thumbnail_url );
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, '15');
$image_data = curl_exec($ch);
curl_close($ch);
}
else
{
$target = parse_url($thumbnail_url);
$fp = fsockopen($target['host'], 80, $errno, $errstr, 15);
if( is_resource($fp) )
{
fputs($fp, "GET {$thumbnail_url} HTTP/1.0\r\n");
fputs($fp, "Host: {$target['host']}\r\n");
fputs ($fp,"User-Agent: ExpressionEngine PHP/" . phpversion() . "\r\n\r\n");
$headers = TRUE;
while( ! feof($fp))
{
$line = fgets($fp, 4096);
if ($headers === FALSE)
{
$image_data .= $line;
}
elseif (trim($line) == '')
{
$headers = FALSE;
}
}
fclose($fp);
}
}
}
//$contents = @file_get_contents($url);
$thumb = unserialize(trim($image_data));
$video['id'] = $video_id;
# Return url to thumbnail so image can be downloaded.
$video['url'] = $thumb[0][thumbnail_medium];
return $video;
}
}
?>
Co edytować by można było dodawać filmy z megavideo?
Edytowany przez xDanielxmc, 24 październik 2010 - 10:17.




Ten temat jest zablokowany

2.5 V6 i500 by Duke_















