We now have all the pieces in place to start displaying the pictures in our gallery. We simply have to load all the thumbnails associated with the user and show them on the page. When clicked, a thumbnail will display the full-size picture.
Since we store references to uploaded images in the database, we can easily write a function to query all images with the given user ID in our db namespace.
(defn images-by-user [userid]
res ["select * from images where userid = ?" userid] (doall res)))
Let’s test that the function does what we intended by running it against a user we registered earlier and see if we get a list of ...