diff options
Diffstat (limited to 'src/chef/utils.clj')
-rw-r--r-- | src/chef/utils.clj | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/chef/utils.clj b/src/chef/utils.clj index 7ccaf88..e2725ce 100644 --- a/src/chef/utils.clj +++ b/src/chef/utils.clj @@ -3,7 +3,8 @@ [honey.sql :as sql] [next.jdbc :as jdbc] [ring.util.response :as ruresp] - [clojure.string :as cstr])) + [clojure.string :as cstr]) + (:import java.io.File)) (defn gen-page [title & content] [:html @@ -54,3 +55,11 @@ (->> s (re-matches #"(([A-z0-9 ]*)=([0-9]*) ?([A-z]*)\n?)*") some?))) + +(defn get-thumbnail-file [recipe] + (let [thumbnails-folder (File. "./thumbnails/")] + (->> thumbnails-folder + .listFiles + (filter #(cstr/starts-with? (.getName ^File %) + (str (:recipes/id recipe) "."))) + first))) |