 
 (defn image-format-of [filename]
   (when filename
-    (first
+    (last
       (first
-        (filter (fn [[_ suffix]]
+        (filter (fn [[suffix _]]
                   (.endsWith filename suffix)) formats)))))
 
 (defn put-original [tempfile s3-name format]

(def cdn "http://c.ontrail.net")
(def upload-url "/file-upload/upload.html")

(def formats {:png ".png" :gif ".gif" :jpg ".jpg"})

(defn image-size [buffered-image]
  (when buffered-image


(defn temp-file [format]
  (when format
    (File/createTempFile "upload-resize" (normal-suffixes format))))

(defn write-image [buffered-image format]
  (when buffered-image
