height / width / rounding foobar
This commit is contained in:
parent
2e5dd5d251
commit
d9a2a7f247
|
@ -104,7 +104,7 @@ class Product(models.Model):
|
||||||
def get_view_size(self, width=800):
|
def get_view_size(self, width=800):
|
||||||
aspect_ratio = self.typ.aspect_ratio
|
aspect_ratio = self.typ.aspect_ratio
|
||||||
width = width + .0
|
width = width + .0
|
||||||
height = int(width // aspect_ratio)
|
height = int(round(width / aspect_ratio))
|
||||||
return (int(width), height,)
|
return (int(width), height,)
|
||||||
|
|
||||||
class Video(models.Model):
|
class Video(models.Model):
|
||||||
|
@ -310,11 +310,12 @@ class Article(models.Model):
|
||||||
# product = Product.objects.get(pk=self.product.id)
|
# product = Product.objects.get(pk=self.product.id)
|
||||||
aspect_ratio = self.typ.aspect_ratio
|
aspect_ratio = self.typ.aspect_ratio
|
||||||
width = 800
|
width = 800
|
||||||
height = int(round(800.0 // aspect_ratio))
|
height = 800.0 / aspect_ratio
|
||||||
return (width, height,)
|
return (width, height,)
|
||||||
|
|
||||||
def print_size(self, print_width):
|
def print_size(self, print_width):
|
||||||
height = print_width / aspect_ratio
|
aspect_ratio = self.typ.aspect_ratio
|
||||||
|
height = int(round(print_width / aspect_ratio))
|
||||||
multiplier = print_width / (self.editor_width + .0)
|
multiplier = print_width / (self.editor_width + .0)
|
||||||
return (self.print_width, height, multiplier,)
|
return (self.print_width, height, multiplier,)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user