I am trying to check the image size before saving it. I do not need to change it, just make sure it meets my limitations.
Now I can read the file and save it to AWS without any problems.
output['pic file'] = request.POST['picture_file']
conn = myproject.S3.AWSAuthConnection(aws_key_id, aws_key)
filedata = request.FILES['picture'].read()
content_type = 'image/png'
conn.put(
bucket_name,
request.POST['picture_file'],
myproject.S3.S3Object(filedata),
{'x-amz-acl': 'public-read', 'Content-Type': content_type},
)
I need to take a middle step so that the file has the correct size and width dimensions. My file does not come from a form that uses ImageField, and all the solutions I saw use it.
Is there a way to do something like
img = Image.open(filedata)
source
share