|
|
|
|
@ -371,5 +371,19 @@ def translation(request):
|
|
|
|
|
return HttpResponse('请使用POST方法')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@csrf_exempt
|
|
|
|
|
def flip(request):
|
|
|
|
|
if request.method == 'POST':
|
|
|
|
|
para = json.loads(request.body)
|
|
|
|
|
image = para['img']
|
|
|
|
|
img = cv2.imread(PREFIX + image)
|
|
|
|
|
flip_code = para.get('flip', 1)
|
|
|
|
|
img = cv2.flip(img, flip_code)
|
|
|
|
|
filename = getImageName() + DEFAULT_FORMAT
|
|
|
|
|
cv2.imwrite(PREFIX + filename, img)
|
|
|
|
|
return HttpResponse(filename)
|
|
|
|
|
return HttpResponse('请使用POST方法')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def r(request):
|
|
|
|
|
return render(request, 'upload.html')
|
|
|
|
|
|