Commits

Daniel Poelzleithner committed 6b6c82f

speedup member image loading when non set

we can add the location of the default file directy instead of going through another slow request

Comments (0)

Files changed (1)

app/main/member_image/_show.lua

   :add_where{ "image_type = ?", image_type }
   :optional_object_mode()
   :exec()
+
 if image or show_dummy then
   if config.fastpath_url_func then
     ui.image{
       external = config.fastpath_url_func(member.id, image_type)
     }
   else
-    ui.image{
-      attr = { class = "member_image member_image_" .. image_type },
-      module = "member_image",
-      view = "show",
-      extension = "jpg",
-      id = member.id,
-      params = {
-        image_type = image_type
+    if not image then
+      ui.image{
+        attr = { class = "member_image member_image_" .. image_type },
+        external = encode.url{ static = (config.member_image_default_file[image_type] or 'icons/16/lightning.png')},
       }
-    }
+    else
+      ui.image{
+        attr = { class = "member_image member_image_" .. image_type },
+        module = "member_image",
+        view = "show",
+        extension = "jpg",
+        id = member.id,
+        params = {
+          image_type = image_type
+        }
+      }
+    end
   end
 end