You are here

function asset_bonus_swfobject_preview in Asset 6

Same name in this branch
  1. 6 asset_bonus/asset_bonus.module \asset_bonus_swfobject_preview()
  2. 6 contrib/asset_bonus/asset_bonus.module \asset_bonus_swfobject_preview()
Same name and namespace in other branches
  1. 5.2 contrib/asset_bonus/asset_bonus.module \asset_bonus_swfobject_preview()
  2. 5 asset_bonus/asset_bonus.module \asset_bonus_swfobject_preview()

File

contrib/asset_bonus/asset_bonus.module, line 232

Code

function asset_bonus_swfobject_preview($asset) {
  require_once drupal_get_path('module', 'asset_bonus') . '/swfheader/swfheader.class.php';
  $swf = new swfheader();
  list($w, $h) = explode('|', $swf
    ->getDimensions($asset->filepath));
  if (!$w) {
    $w = "240";
    $h = "180";
  }
  $r = $w > $h ? $w / 150 : $h / 150;
  $attr = array(
    'height' => $h / $r,
    'width' => $w / $r,
    'version' => $swf->version,
    'bgcolor' => '#FFFFFF',
  );
  $output = theme('asset_bonus_swfobject', $asset, $attr);
  return $output;
}