When I upload an image via Django to Amazon's S3, the image size nearly doubles. For example, I upload an image to Django that is 17.4KB, but when I look at my S3 bucket, the image is 33.2KB.
Is there a reason why this is happening? Below are my forms and views to see the processes. I can't seem to figure out why this is happening.
forms.py:
class PhotoUploadForm(forms.ModelForm):
class Meta:
model = Photo
fields = ('photo',)
views.py:
@login_required
def photo_upload(request):
form = PhotoUploadForm(request.POST or None,
request.FILES or None,
request=request)
if request.method == 'POST':
if form.is_valid():
obj = form.save(commit=False)
obj.creator = request.user
obj.slug = get_random_string(length=10)
obj.save()
return HttpResponseRedirect(reverse('home'))
return render(request, 'photos/photo_upload.html', {'form': form})
Thank you in advance for any help!
Aucun commentaire:
Enregistrer un commentaire