function ckeditor_swf_getinfo in CKEditor SWF - Enhanced Flash embedding plugin 6.2
Same name and namespace in other branches
- 6 ckeditor_swf.module \ckeditor_swf_getinfo()
- 7 ckeditor_swf.module \ckeditor_swf_getinfo()
1 string reference to 'ckeditor_swf_getinfo'
- ckeditor_swf_menu in ./
ckeditor_swf.module - Implementation of hook_menu().
File
- ./
ckeditor_swf.module, line 35 - Written by Henri MEDOT <henri.medot[AT]absyx[DOT]fr> http://www.absyx.fr
Code
function ckeditor_swf_getinfo() {
drupal_set_header('Content-Type: text/javascript; charset=utf-8');
$output = 'null';
$url = check_url($_REQUEST['src']);
// Attempt to retrieve info using GD2.
$info = @getimagesize($url);
if ($info) {
if ($info['mime'] == 'application/x-shockwave-flash') {
$output = '{"mime":"application/x-shockwave-flash", "width":' . $info[0] . ', "height":' . $info[1] . '}';
}
}
else {
// Attempt to retrieve info using getID3
$info = ckeditor_swf_getid3_analyze($url);
if (isset($info['mime_type'], $info['fileformat'])) {
$mime = $info['mime_type'];
$format = $info['fileformat'];
$prefix = substr($mime, 0, 6);
if (isset($info['video']['resolution_x'], $info['video']['resolution_y']) && ($prefix == 'video/' || ($mime = 'video/' . $format))) {
$output = '{"mime":"' . $mime . '", "width":' . $info['video']['resolution_x'] . ', "height":' . $info['video']['resolution_y'] . '}';
}
elseif (isset($info['audio']) && ($prefix == 'audio/' || ($mime = 'audio/' . $format))) {
$output = '{"mime":"' . $mime . '"}';
}
}
}
print $output;
exit;
}