Skip to content

Instantly share code, notes, and snippets.

@wanderingmatt
Created February 10, 2009 19:05
Show Gist options
  • Save wanderingmatt/61538 to your computer and use it in GitHub Desktop.
Save wanderingmatt/61538 to your computer and use it in GitHub Desktop.
<% if content_item_preview && content_item_preview.ready? %>
<div id="preview_container">
<h4>Preview</h4>
<div id="<%= content_item_preview.obfuscated_id %>" style="max-width: <%= content_item_preview.metadata[:width] %>px;, max-height: <%= content_item_preview.metadata[:height] %>px">
<% if content_item_preview.is_image? %>
<%= image_tag(url_for(:controller => '/content_item_previews', :action => 'show', :id => content_item_preview.obfuscated_id, :filename => content_item_preview.filename), :title => 'Preview', :alt => 'Preview') %>
<% elsif content_item_preview.is_video? %>
Alternate Content
<% content_for :javascript_includes do %>
<script type="text/javascript">
var flashvars = {};
flashvars.file = "<%= url_for(hub_url(@hub, :controller => '/content_item_previews', :action => 'show', :id => content_item_preview.obfuscated_id, :filename => content_item_preview.filename, :only_path => false)) %>";
var params = {};
params.wmode = "transparent";
params.allowfullscreen = "true";
params.allowscriptaccess = "always";
var attributes = {};
swfobject.embedSWF("/swfs/player.swf", "<%= content_item_preview.obfuscated_id %>", "100%", "<%= content_item_preview.metadata[:height] %>", "9.0.98", false, flashvars, params, attributes);
</script>
<% end %>
<%- end -%>
</div>
</div>
<%- end -%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment