Downloading and manipulating images in Django

综合编程 Hello, buddy! (源链)

I am trying upload images and than create an thumbnail of it and than store both in S3. After the file has been uploaded i am first uploading it to S3 and than trying to create thumbnail but it doesn’t work as than PIL is not able to recognise the image. And secondly if I create the thumbnail first than while uploading original image I get EOF.

I think Django allows just once for the uploaded files to be used only once….Please kindly tell me a way to do so….Thanks in advance

Uhm, you need to be more specific with your question, but we’re doing the same thing and the workflow is as follows:

1) You get the file handle on file upload from request.FILES and store it somewhere on your local filesystem, so you don’t work on stream — which is what i would guess is causing your problems

2) You use PIL (or better yet, Pillow) to manipulate the image on the FS, do resizing, thumbnailing, whatever.

3) You use Boto ( to upload to S3, because Boto takes the handling of AWS out of your hands.

It’s quite straightforward and works well


Django之–通过MVC架构的html模板展示Hello World!... 上一篇: Django之--网页展示Hello World! 初步说明了如何使用Django来显示hello world,本文略微进阶下使用html模板来展示hello world~ 首先在mysite同级目录创建templates目录,用于专门存放html模板: # tree ....
Django Templates: How can you remove the... Someone has probably encountered this before, and perhaps even the docs provide a solution already, but I couldn't find it yet. My situation is this: ...
Django的url(一) URLconf 在settings.py文件中通过ROOT_URLCONF指定根级url的配置 urlpatterns是一个url()实例的列表 一个url()对象包括: 1 正则表达式 2 视图函数 3...
小司机带你学: Django+Xadmin打造在线教育平台(二)... 老话总是没错的,工欲善其事,必先利其器 使用Django+Xadmin打造在线教育平台 第二章:windows下搭建开发环境 教你安装pycharm,mysql,navicat,python相关环境。 教程仓库地址1:
django 发送手机验证码 一、流程分析: 1.用户在项目前端,输入手机号,然后点击【获取验证码】,将手机号发到post到后台。 2.后台验证手机号是否合法,是否已被占用,如果通过验证,则生成验证码,并通过运行脚本,让短信运营商向该手机号,发送该验证码,如果没通过验证,则返回错误信息 3.用户收到短信验证码以后,再...
Hello, buddy!责编内容来自:Hello, buddy! (源链) | 更多关于

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » Downloading and manipulating images in Django

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录