          (uuid? collid)
          (uuid? imageid)]}
   (let [filename (fs/base-name localpath)
-        [width height] (retrieve-image-size localpath)
+        storage media/images-storage
+        [width height] (time (retrieve-image-size localpath))
         extension (second (fs/split-ext filename))
         path @(st/save storage filename localpath)
         params {:name filename


(defn- start-system
  []
  (-> (mount/only #{#'uxbox.config/config
                    #'uxbox.db/datasource
                    #'uxbox.migrations/migrations})
      (mount/start)))

(defn- stop-system
  []
  (mount/stop))

(defn- run-importer
  [directory data]
  (println "Running importer on:")
  (pprint data))

(defn -main
  [& [path]]
  (let [[directory data] (read-import-file path)]
    (start-system)
    (try
      (run-importer directory data)
      (finally
        (stop-system)))))


;; --- Colors Collections Importer

(defn- create-image-collection
  "Create or replace image collection by its name."
  [conn {:keys [name] :as entry}]
  (println "Creating image collection:" name)
  (let [id (uuid/namespaced +imates-uuid-ns+ name)
        sqlv (sql/create-image-collection {:id id :name name})]
    (sc/execute conn sqlv)
