|
@@ -38,10 +38,12 @@ def replace():
|
|
return jsonify(error_resp("请选择需要替换的背景!"))
|
|
return jsonify(error_resp("请选择需要替换的背景!"))
|
|
|
|
|
|
img_path = get_upload_file_path(form.file_id.data)
|
|
img_path = get_upload_file_path(form.file_id.data)
|
|
|
|
+ bg_path = form.background.data
|
|
|
|
|
|
- bg_path = get_upload_file_path(form.bg_file_id.data)
|
|
|
|
- if os.path.exists(bg_path) is False:
|
|
|
|
- bg_path = form.background.data
|
|
|
|
|
|
+ if is_empty(form.bg_file_id.data) is False:
|
|
|
|
+ bg_path = get_upload_file_path(form.bg_file_id.data)
|
|
|
|
+ if os.path.exists(bg_path):
|
|
|
|
+ bg_path = form.background.data
|
|
|
|
|
|
result = tools.replace(img_path=img_path, background=bg_path, save_dir=get_output_dir())
|
|
result = tools.replace(img_path=img_path, background=bg_path, save_dir=get_output_dir())
|
|
|
|
|