Skip to content

Commit

Permalink
Add support for uploading HEVC videos
Browse files Browse the repository at this point in the history
  • Loading branch information
mawise committed Dec 31, 2024
1 parent 7400a8e commit 7f15753
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/controllers/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/views/posts/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand Down

0 comments on commit 7f15753

Please sign in to comment.