2006/9/7
■ [sns] YouTube plugin for sns
ここを参考に sns用の YouTube plugin を作ってみました.
といってもほぼコピーですが...
下記の内容を plugin/youtube.pl に書いて
{{youtube("ID", "size")}}
の形で呼び出します.
# youtube.pl - YouTube plugin for sns
# usage: {{youtube("ID","size")}}
# size = 1,2,3,...,5,... (large)
# ex: {{youtube("bMMmxorsg4Y","2")}}
sub youtube {
my ($id, $size) = @_;
$size = 5 if (not defined $size or $size < 1);
my $url = "http://www.youtube.com/v/$id";
my ($w, $h) = (85 * $size, 70 * $size);
return qq(<object width="$w" height="$h">).
qq(<param name="movie" value="$url"></param>).
qq(<embed src="$url" type="application/x-shockwave-flash" ).
qq(width="$w" height="$h"></embed></object><br>\n);
}