From 7f15753b6276762cf6690748e42b4f81e2971e4f Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 30 Dec 2024 19:38:45 -0600 Subject: [PATCH] Add support for uploading HEVC videos --- app/controllers/posts_controller.rb | 6 +++--- app/views/posts/_form.html.erb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 9c931af..92a5287 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -196,15 +196,15 @@ def require_signed_in def handle_form_submit(params, view) @post = post_from_form(params) if params[:commit] == "Upload Selected Image" - if !(params[:post][:pic].nil?) + if !(params[:post][:pic].nil?) begin @image = Image.new @image.blob.attach params[:post][:pic] @image.save - file_ext = path_for(@image.blob).split(".").last + file_ext = path_for(@image.blob).split(".").last.downcase if (file_ext == "mp3") @post.content += process_new_audio(@image) - elsif ["mp4","mov"].include? file_ext + elsif ["mp4","mov","hevc"].include? file_ext @post.content += process_new_video(@image) else @post.content += process_new_image(@image) diff --git a/app/views/posts/_form.html.erb b/app/views/posts/_form.html.erb index 360383f..60fda57 100644 --- a/app/views/posts/_form.html.erb +++ b/app/views/posts/_form.html.erb @@ -3,7 +3,7 @@ <%= form.date_field :date, :style => 'display:inline;', :value => @post.datetime.strftime("%Y-%m-%d"), type: (@show_date ? :date : :hidden) %> <%= form.time_field :time, :style => 'display:inline;', :value => @post.datetime.strftime("%H:%M"), type: (@show_date ? :time : :hidden) %> <%= form.text_area :content, :rows => 10, :dir => "auto", :style => 'display:block;width:100%;', :oninput => "doRender()", :value => @post.content %> - <%= form.file_field :pic, :accept => "image/*,.mp4,.mov,.mp3", :style => "display:inline;" %> + <%= form.file_field :pic, :accept => "image/*,.mp4,.mov,.hevc,.mp3", :style => "display:inline;" %> <%= form.submit :value => "Upload Selected Image", data: {disable_with: "Upload Selected Image"}, :style => "display:inline;" %> <%= form.submit :value => "Save Post", :style => "display:block;" %> <% end %>