liquid_feedback_frontend
diff 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 |
line diff
1.1 --- a/app/main/member_image/show.lua Sat Mar 21 15:03:39 2015 +0100 1.2 +++ b/app/main/member_image/show.lua Sat Mar 21 15:26:39 2015 +0100 1.3 @@ -1,16 +1,10 @@ 1.4 local image_type = param.get("image_type") 1.5 local record = MemberImage:by_pk(param.get_id(), image_type, true) 1.6 1.7 -print('Cache-Control: max-age=300'); -- let the client cache the image for 5 minutes 1.8 - 1.9 if record == nil then 1.10 - local default_file = ({ avatar = "avatar.jpg", photo = nil })[image_type] 1.11 - if default_file then 1.12 - print('Location: ' .. encode.url{ static = default_file } .. '\n\n') 1.13 - else 1.14 - print('Location: ' .. encode.url{ static = 'icons/16/lightning.png' } .. '\n\n') 1.15 - end 1.16 - exit() 1.17 + local default_file = ({ avatar = "avatar.jpg", photo = nil })[image_type] or 'icons/16/lightning.png' 1.18 + request.redirect{ static = default_file } 1.19 + return 1.20 end 1.21 1.22 assert(record.content_type, "No content-type set for image.") 1.23 @@ -18,5 +12,6 @@ 1.24 slot.set_layout(nil, record.content_type) 1.25 1.26 if record then 1.27 + request.add_header("Cache-Control", "max-age=300"); -- let the client cache the image for 5 minutes 1.28 slot.put_into("data", record.data) 1.29 end