0

Is there a way to upload images with a specific size like width: 300, height:320 Using this in my model: image = CloudinaryField('image')

I think is important to say I am working with the default admin site. image upload is working properly.

Du_
  • 915
  • 1
  • 9
  • 16
  • You can use validators on your CloudinaryField – dentemm Apr 11 '17 at 15:38
  • Sorry I am new with this. How do you add a validator? – Du_ Apr 11 '17 at 15:39
  • Validators are explained [here](https://docs.djangoproject.com/en/1.10/ref/validators/). The concept is very easy. You write a function that checks the image size, and add this function as validator to your field. This then gets checked before uploading. – dentemm Apr 11 '17 at 15:40
  • This will check the size but not transform the size – Du_ Apr 11 '17 at 15:52
  • You can use sorl-thumbnail to generate thumbnails for uploaded images. Then you could for instance require minimum dimensions for your CloudinaryField with validators and afterwards use sorl to create the image with the required dimensions. – dentemm Apr 11 '17 at 15:55
  • You can set the dimensions and other manipulations as [incoming transformations](http://cloudinary.com/documentation/upload_images#incoming_transformations) in your [upload preset](http://cloudinary.com/documentation/upload_images#upload_presets) – Maor.G Apr 18 '17 at 10:30

0 Answers0