comparison app/views/tweets/_tweet.html.erb @ 253:d726e8b92dd1

Support animated gif (same as video)
author nanaya <me@nanaya.net>
date Mon, 25 Mar 2024 02:49:50 +0900
parents be0b78fb5f57
children c6a50441a58d
comparison
equal deleted inserted replaced
252:151bc6d97d39 253:d726e8b92dd1
38 <% end %> 38 <% end %>
39 </p> 39 </p>
40 40
41 <p> 41 <p>
42 <% tweet[:entity_media].each do |_short_url, media| %> 42 <% tweet[:entity_media].each do |_short_url, media| %>
43 <% if media[:type] == 'photo' %> 43 <% case media[:type] %>
44 <%= link_to "#{media[:image_url]}?name=orig" do %> 44 <% when 'photo' %>
45 <%= image_tag "#{media[:image_url]}?name=small", :alt => "attachment #{media[:id]}" -%> 45 <%= link_to "#{media[:image_url]}&name=orig" do %>
46 <% end %> 46 <%= image_tag "#{media[:image_url]}&name=small", :alt => "attachment #{media[:id]}" -%>
47 <% elsif media[:type] == 'video' %> 47 <% end %>
48 <%= video_tag media[:variants] 48 <% when 'animated_gif', 'video' %>
49 .sort_by { |variant| -variant[:bitrate] } 49 <%= video_tag media[:variants]
50 .map { |variant| variant[:url] }, width: '100%', controls: true 50 .sort_by { |variant| -variant[:bitrate] }
51 %> 51 .map { |variant| variant[:url] }, width: '100%', controls: true
52 %>
52 <% end %> 53 <% end %>
53 <% end %> 54 <% end %>
54 </p> 55 </p>
55 56
56 <% if tweet[:quote_id].present? %> 57 <% if tweet[:quote_id].present? %>