我正在尝试从像PHP函数的字符串加载图像 imagecreatefromstring
我怎样才能做到这一点?
我有MySQL blob字段图像.我正在使用MySQLdb,并且不希望创建临时文件来处理PyOpenCV中的图像.
注意:需要cv(不是cv2)包装函数
我想知道如何通过创建API服务上传文件?
class UploadImage(Resource):
def post(self, fname):
file = request.files['file']
if file:
# save image
else:
# return error
return {'False'}
Run Code Online (Sandbox Code Playgroud)
路线
api.add_resource(UploadImage, '/api/uploadimage/<string:fname>')
Run Code Online (Sandbox Code Playgroud)
然后是HTML
<input type="file" name="file">
Run Code Online (Sandbox Code Playgroud)
我在服务器端启用了CORS
我使用angular.js作为前端和ng-upload,如果这很重要,但也可以使用CURL语句!