fix pdf ratio

This commit is contained in:
j 2014-01-05 11:40:54 +00:00
parent 700e61b128
commit 6b63239cf7

View file

@ -225,16 +225,17 @@ class Document(models.Model):
if self.extension == 'pdf': if self.extension == 'pdf':
self.make_thumbnail() self.make_thumbnail()
image = self.thumbnail() image = self.thumbnail()
else:
image = self.file.path
if self.width > 0:
size = self.resolution
else:
try: try:
size = Image.open(image).size size = Image.open(image).size
except: except:
size = [1,1] size = [1,1]
else:
if self.width > 0:
size = self.resolution
else:
size = [1,1]
self.ratio = size[0] / size[1] self.ratio = size[0] / size[1]
return self.ratio
def update_matches(self): def update_matches(self):
import annotation.models import annotation.models