fix pdf ratio
This commit is contained in:
parent
700e61b128
commit
6b63239cf7
1 changed files with 6 additions and 5 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue