Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for uploading HEVC videos #132

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading