Answer the question
In order to leave comments, you need to log in
How to change the extension of an image loaded via ajax?
Through ajax I load the image, and the server receives it like this:
@csrf_exempt
def ajax_img_loadDef(request):
if request.method == 'POST':
# получит изображение
img_load = request.FILES['img_load']
# заменит изображение с расширением gif на jpg
#
return HttpResponse('success')
Answer the question
In order to leave comments, you need to log in
if you just need to change the extension - save it to a file with the extension you need. and all.
and if you need to convert gif to jpg , then you will have to use some kind of graphics library, for example, pillow
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question