def get_image_file(uuid, image_file_path):
"""GetImageFile (GET /images/:uuid/file)
Return the image file.
"""
encoded_md5 = get_image_file_md5(uuid, image_file_path)
if NGINX_ENABLED:
res = make_response('')
res.headers['Content-Type'] = 'application/octet-stream'
res.headers['X-Accel-Redirect'] = '/static/images/%s/file?md5=%s' % (uuid, encoded_md5)
else:
res = make_response(send_file(image_file_path, add_etags=False, cache_timeout=0))
res.headers['Content-Length'] = get_image_file_size(image_file_path)
res.headers['Content-MD5'] = encoded_md5
return res
评论列表
文章目录