liquid_feedback_frontend

annotate app/main/member_image/show.lua @ 1145:904f6807f7fa

Added support for upcoming moonbridge bases WebMCP
author bsw
date Sat Mar 21 15:26:39 2015 +0100 (2015-03-21)
parents f52f918b38b8
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

Impressum / About Us