I want to create multiple copies of an image and resize them using celery after the original image was sent.
def save_model(self, request, obj, form, change):
updated = change
super().save_model(request, obj, form, change)
if not updated:
logo = CompanyLogo(logo=form.cleaned_data['logo'], company=obj)
logo.save()
# Send Celery task to create resize images
task_company_logo.delay(form.cleaned_data['logo'])
called by task method
def crop_image(path):
image = Image.open(os.path.join(settings.MEDIA_ROOT, path))
image.show()
I have the following error:
'InMemoryUploadedFile' is not JSON serializable
I understand the error, because I send the all image obj from the form, I just want to get the path to the original image.