0
A
답변
4
파일이 항상 이미지, 이와 같은 ImageField
로 변경 FileField
될 경우 :
from django.core.files.images import get_image_dimensions
obj = MModel.objects.get(pk=1)
width, height = get_image_dimensions(obj.document.file)
당신은 할 수 있습니다
그렇지 않으면, 당신은 수동으로 이미지의 폭과 높이를 계산해야합니다 그것을'ImageField'로 바꾸고'width_field'와'height_field' 인자를 사용하십시오. – Selcuk
ImageField (MModel.objects.all() [0])를 의미합니까? height ?? –