liquid_feedback_frontend
annotate app/main/member_image/show.lua @ 1146:ce9daada32dd
Removed unnecessary image from style
author | bsw |
---|---|
date | Sun Mar 22 17:32:05 2015 +0100 (2015-03-22) |
parents | 904f6807f7fa |
children | 24787d0d9317 |
rev | line source |
---|---|
bsw/jbe@4 | 1 local image_type = param.get("image_type") |
bsw/jbe@4 | 2 local record = MemberImage:by_pk(param.get_id(), image_type, true) |
bsw/jbe@4 | 3 |
bsw/jbe@4 | 4 if record == nil then |
bsw@1145 | 5 local default_file = ({ avatar = "avatar.jpg", photo = nil })[image_type] or 'icons/16/lightning.png' |
bsw@1145 | 6 request.redirect{ static = default_file } |
bsw@1145 | 7 return |
bsw/jbe@4 | 8 end |
bsw/jbe@4 | 9 |
bsw/jbe@52 | 10 assert(record.content_type, "No content-type set for image.") |
bsw/jbe@52 | 11 |
bsw/jbe@52 | 12 slot.set_layout(nil, record.content_type) |
bsw/jbe@4 | 13 |
bsw/jbe@4 | 14 if record then |
bsw@1145 | 15 request.add_header("Cache-Control", "max-age=300"); -- let the client cache the image for 5 minutes |
bsw/jbe@52 | 16 slot.put_into("data", record.data) |
bsw/jbe@4 | 17 end |