liquid_feedback_frontend
annotate app/main/member_image/show.lua @ 434:5a4f5cc161d7
Put admin button to footer
author | bsw |
---|---|
date | Sun Mar 11 09:14:19 2012 +0100 (2012-03-11) |
parents | 034f96181e59 |
children | f52f918b38b8 |
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 |
poelzi@148 | 4 print('Cache-Control: max-age=300'); -- let the client cache the image for 5 minutes |
poelzi@148 | 5 |
bsw/jbe@4 | 6 if record == nil then |
bsw/jbe@4 | 7 local default_file = config.member_image_default_file[image_type] |
bsw/jbe@4 | 8 if default_file then |
bsw/jbe@4 | 9 print('Location: ' .. encode.url{ static = default_file } .. '\n\n') |
bsw/jbe@4 | 10 else |
bsw/jbe@4 | 11 print('Location: ' .. encode.url{ static = 'icons/16/lightning.png' } .. '\n\n') |
bsw/jbe@4 | 12 end |
bsw/jbe@4 | 13 exit() |
bsw/jbe@4 | 14 end |
bsw/jbe@4 | 15 |
bsw/jbe@52 | 16 assert(record.content_type, "No content-type set for image.") |
bsw/jbe@52 | 17 |
bsw/jbe@52 | 18 slot.set_layout(nil, record.content_type) |
bsw/jbe@4 | 19 |
bsw/jbe@4 | 20 if record then |
bsw/jbe@52 | 21 slot.put_into("data", record.data) |
bsw/jbe@4 | 22 end |