Resizing image on upload with django-imagekit

痴心易碎 提交于 2019-12-06 07:23:55

follow the link above.

  • Create processors as you like for original image (resize, enhance, etc). Look imagekit wiki for examples

    class ResizeOriginal(processors.Resize): 
        width = 640 
        height = 480
    
  • Create your ImageSpec for this original image with those previously processors. Leave pre_cache as default (false)

    class Original(ImageSpec): 
        processors = [ResizeOriginal] 
    
  • Add that ImageSpec to your IKoptions ImageModel preprocessor.

    preprocessor_spec = Original

goh

I believe the updated answer is ProcessedImageField.

Reference taken from @matthew.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!