liquid_feedback_frontend

view app/main/member_image/show.lua @ 1147:24787d0d9317

Updated delivery and cache control of member images
author bsw
date Sun Mar 22 17:32:38 2015 +0100 (2015-03-22)
parents 904f6807f7fa
children 8874448bbb7a
line source
1 local image_type = param.get("image_type")
2 local record = MemberImage:by_pk(param.get_id(), image_type, true)
4 local data, content_type
6 if record then
7 data = record.data
8 assert(record.content_type, "No content-type set for image.")
9 content_type = record.content_type
11 else
12 local default_file = "avatar.jpg"
13 content_type = "image/jpeg"
14 if image_type == "photo" then
15 default_file = "icons/16/lightning.png"
16 content_type = "image/png"
17 end
19 local filename = WEBMCP_BASE_PATH .. "static/" .. default_file
21 local f = assert(io.open(filename), "Cannot open default image file")
22 data = f:read("*a")
23 f:close()
25 end
27 request.allow_caching()
29 slot.set_layout(nil, content_type)
30 slot.put_into("data", data)

Impressum / About Us