aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/lib/active_storage/previewer
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2018-01-03 22:01:31 -0500
committerGeorge Claghorn <george@basecamp.com>2018-01-03 22:01:31 -0500
commita72473f0320cc58bea1b47c856c62f015d5da82b (patch)
tree9c5051a4fbdcac0cd0795022a1769779561c52ae /activestorage/lib/active_storage/previewer
parentbce675eac49a8673d63ea41991f020aa3aa8c506 (diff)
downloadrails-a72473f0320cc58bea1b47c856c62f015d5da82b.tar.gz
rails-a72473f0320cc58bea1b47c856c62f015d5da82b.tar.bz2
rails-a72473f0320cc58bea1b47c856c62f015d5da82b.zip
Configure previewer/analyzer command paths centrally
Diffstat (limited to 'activestorage/lib/active_storage/previewer')
-rw-r--r--activestorage/lib/active_storage/previewer/pdf_previewer.rb6
-rw-r--r--activestorage/lib/active_storage/previewer/video_previewer.rb6
2 files changed, 8 insertions, 4 deletions
diff --git a/activestorage/lib/active_storage/previewer/pdf_previewer.rb b/activestorage/lib/active_storage/previewer/pdf_previewer.rb
index b84aefcc9c..426ff51eb1 100644
--- a/activestorage/lib/active_storage/previewer/pdf_previewer.rb
+++ b/activestorage/lib/active_storage/previewer/pdf_previewer.rb
@@ -2,8 +2,6 @@
module ActiveStorage
class Previewer::PDFPreviewer < Previewer
- class_attribute :mutool_path, default: "mutool"
-
def self.accept?(blob)
blob.content_type == "application/pdf"
end
@@ -20,5 +18,9 @@ module ActiveStorage
def draw_first_page_from(file, &block)
draw mutool_path, "draw", "-F", "png", "-o", "-", file.path, "1", &block
end
+
+ def mutool_path
+ ActiveStorage.paths[:mutool] || "mutool"
+ end
end
end
diff --git a/activestorage/lib/active_storage/previewer/video_previewer.rb b/activestorage/lib/active_storage/previewer/video_previewer.rb
index 5d06e33f44..2f28a3d341 100644
--- a/activestorage/lib/active_storage/previewer/video_previewer.rb
+++ b/activestorage/lib/active_storage/previewer/video_previewer.rb
@@ -2,8 +2,6 @@
module ActiveStorage
class Previewer::VideoPreviewer < Previewer
- class_attribute :ffmpeg_path, default: "ffmpeg"
-
def self.accept?(blob)
blob.video?
end
@@ -21,5 +19,9 @@ module ActiveStorage
draw ffmpeg_path, "-i", file.path, "-y", "-vcodec", "png",
"-vf", "thumbnail", "-vframes", "1", "-f", "image2", "-", &block
end
+
+ def ffmpeg_path
+ ActiveStorage.paths[:ffmpeg] || "ffmpeg"
+ end
end
end