Skip to content

Commit 823401a

Browse files
committed
Add support for uploading HEVC videos
1 parent 7400a8e commit 823401a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/controllers/posts_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,15 @@ def require_signed_in
196196
def handle_form_submit(params, view)
197197
@post = post_from_form(params)
198198
if params[:commit] == "Upload Selected Image"
199-
if !(params[:post][:pic].nil?)
199+
if !(params[:post][:pic].nil?)
200200
begin
201201
@image = Image.new
202202
@image.blob.attach params[:post][:pic]
203203
@image.save
204-
file_ext = path_for(@image.blob).split(".").last
204+
file_ext = path_for(@image.blob).split(".").last.downcase
205205
if (file_ext == "mp3")
206206
@post.content += process_new_audio(@image)
207-
elsif ["mp4","mov"].include? file_ext
207+
elsif ["mp4","mov","hevc"].include? file_ext
208208
@post.content += process_new_video(@image)
209209
else
210210
@post.content += process_new_image(@image)

app/views/posts/_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<%= form.date_field :date, :style => 'display:inline;', :value => @post.datetime.strftime("%Y-%m-%d"), type: (@show_date ? :date : :hidden) %>
44
<%= form.time_field :time, :style => 'display:inline;', :value => @post.datetime.strftime("%H:%M"), type: (@show_date ? :time : :hidden) %>
55
<%= form.text_area :content, :rows => 10, :dir => "auto", :style => 'display:block;width:100%;', :oninput => "doRender()", :value => @post.content %>
6-
<%= form.file_field :pic, :accept => "image/*,.mp4,.mov,.mp3", :style => "display:inline;" %>
6+
<%= form.file_field :pic, :accept => "image/*,.mp4,.mov,.hevc,.mp3", :style => "display:inline;" %>
77
<%= form.submit :value => "Upload Selected Image", data: {disable_with: "Upload Selected Image"}, :style => "display:inline;" %>
88
<%= form.submit :value => "Save Post", :style => "display:block;" %>
99
<% end %>

0 commit comments

Comments
 (0)