You are here

function asset_bonus_swfobject_preview in Asset 5

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

File

asset_bonus/asset_bonus.module, line 230

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;
}