bsw/jbe@4: local image_type = param.get("image_type") bsw/jbe@4: local record = MemberImage:by_pk(param.get_id(), image_type, true) bsw/jbe@4: bsw/jbe@4: if record == nil then bsw/jbe@4: local default_file = config.member_image_default_file[image_type] bsw/jbe@4: if default_file then bsw/jbe@4: print('Location: ' .. encode.url{ static = default_file } .. '\n\n') bsw/jbe@4: else bsw/jbe@4: print('Location: ' .. encode.url{ static = 'icons/16/lightning.png' } .. '\n\n') bsw/jbe@4: end bsw/jbe@4: exit() bsw/jbe@4: end bsw/jbe@4: bsw/jbe@4: print('Content-type: ' .. record.content_type .. '\n') bsw/jbe@4: bsw/jbe@4: if record then bsw/jbe@4: io.stdout:write(record.data) bsw/jbe@4: else bsw/jbe@4: end bsw/jbe@4: bsw/jbe@4: exit()