liquid_feedback_frontend

view app/main/member_image/show.lua @ 1148:8874448bbb7a

Avoid caching of member avatar and photo on member page
author bsw
date Sun Mar 22 18:50:36 2015 +0100 (2015-03-22)
parents 24787d0d9317
children dcbe505ddf24
line source
1 local image_type = param.get("image_type")
2 local record = MemberImage:by_pk(param.get_id(), image_type, true)
4 local dynamic = param.get("dynamic")
6 local data, content_type
8 if record then
9 data = record.data
10 assert(record.content_type, "No content-type set for image.")
11 content_type = record.content_type
13 else
14 local default_file = "avatar.jpg"
15 content_type = "image/jpeg"
16 if image_type == "photo" then
17 default_file = "icons/16/lightning.png"
18 content_type = "image/png"
19 end
21 local filename = WEBMCP_BASE_PATH .. "static/" .. default_file
23 local f = assert(io.open(filename), "Cannot open default image file")
24 data = f:read("*a")
25 f:close()
27 end
29 if not dynamic then
30 request.allow_caching()
31 end
33 slot.set_layout(nil, content_type)
34 slot.put_into("data", data)

Impressum / About Us