about summary refs log tree commit diff
path: root/app/lib/fast_geometry_parser.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/lib/fast_geometry_parser.rb')
-rw-r--r--app/lib/fast_geometry_parser.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/lib/fast_geometry_parser.rb b/app/lib/fast_geometry_parser.rb
new file mode 100644
index 000000000..5209c2bc5
--- /dev/null
+++ b/app/lib/fast_geometry_parser.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class FastGeometryParser
+  def self.from_file(file)
+    width, height = FastImage.size(file.path)
+
+    raise Paperclip::Errors::NotIdentifiedByImageMagickError if width.nil?
+
+    Paperclip::Geometry.new(width, height)
+  end
+end