크기가 조정되거나 내 admin
패널을 통해 직접 업로드하는 이미지를 저장할 수 없습니다. PLP
또는 다른 방법으로 크기를 조정하고 싶습니다!업로드하는 동안 이미지의 크기를 조정하고 자동으로 장고를 저장하는 방법?
def get_product_image_folder(instance, filename):
return "static/images/product/%s/base/%s" %(instance.product_id, filename)
product_image = StringIO.StringIO(i.read())
imageImage = Image.open(product_image)
thumbImage = imageImage.resize((100,100))
thumbfile = StringIO()
thumbImage.save(thumbfile, "JPEG")
thumbcontent = ContentFile(thumbfile.getvalue())
newphoto.thumb.save(filename, thumbcontent)
new_photo.save()