I am trying to resize the pic before uploading a pic in Django. Here I am using the CloudinaryField for image data.
name = models.CharField(max_length=100, blank=True, null=True)
image = CloudinaryField('image', default='/media/default_pic.jpg', width_field=1280,height_field=720)
- What I want:
Pictures will be saved as resized such as 1280*720.
- What actually happened:
Cannot resize when i upload the image
- What I have tried:
I have tried set keyword arguments like width_field and height_field which did not work. When you pass an integer like width_field=1280, height_field=720, it will throw an error said requiring string instead of int. But if you change to string '1280' and '720' it does not work at all.
Is there any method to set the size of the picture when uploading?
I know it is possible to resize on HTML easily but just wonder if it is possible to do it before uploading.
Please sign in to leave a comment.