Add faster implementation for retrieve image size.

This commit is contained in:
Andrey Antukh 2016-11-20 21:19:53 +01:00
parent 0192298d09
commit e73339d2f9
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -24,7 +24,8 @@
[uxbox.util.uuid :as uuid] [uxbox.util.uuid :as uuid]
[uxbox.util.data :as data]) [uxbox.util.data :as data])
(:import [java.io Reader PushbackReader] (:import [java.io Reader PushbackReader]
[javax.imageio ImageIO])) [javax.imageio ImageIO]
[org.im4java.core Info]))
;; --- Constants & Specs ;; --- Constants & Specs
@ -63,11 +64,8 @@
(defn- retrieve-image-size (defn- retrieve-image-size
[path] [path]
(let [path (fs/path path) (let [info (Info. (str path) true)]
file (.toFile path) [(.getImageWidth info) (.getImageHeight info)]))
buff (ImageIO/read file)]
[(.getWidth buff)
(.getHeight buff)]))
(defn- retrieve-image (defn- retrieve-image
[conn id] [conn id]