2021-06-19 17:44:14 +00:00
|
|
|
"""Generators for all the different thumbnail sizes"""
|
2021-05-24 14:15:08 +00:00
|
|
|
from imagekit import ImageSpec, register
|
|
|
|
from imagekit.processors import ResizeToFit
|
|
|
|
|
2021-05-24 14:40:25 +00:00
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
class BookXSmallWebp(ImageSpec):
|
2021-06-19 17:44:14 +00:00
|
|
|
"""Handles XSmall size in Webp format"""
|
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
processors = [ResizeToFit(80, 80)]
|
2021-05-24 14:33:40 +00:00
|
|
|
format = "WEBP"
|
|
|
|
options = {"quality": 95}
|
2021-05-24 14:15:08 +00:00
|
|
|
|
2021-05-24 14:40:25 +00:00
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
class BookXSmallJpg(ImageSpec):
|
2021-06-19 17:44:14 +00:00
|
|
|
"""Handles XSmall size in Jpeg format"""
|
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
processors = [ResizeToFit(80, 80)]
|
2021-05-24 14:33:40 +00:00
|
|
|
format = "JPEG"
|
|
|
|
options = {"quality": 95}
|
2021-05-24 14:15:08 +00:00
|
|
|
|
2021-05-24 14:40:25 +00:00
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
class BookSmallWebp(ImageSpec):
|
2021-06-19 17:44:14 +00:00
|
|
|
"""Handles Small size in Webp format"""
|
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
processors = [ResizeToFit(100, 100)]
|
2021-05-24 14:33:40 +00:00
|
|
|
format = "WEBP"
|
|
|
|
options = {"quality": 95}
|
2021-05-24 14:15:08 +00:00
|
|
|
|
2021-05-24 14:40:25 +00:00
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
class BookSmallJpg(ImageSpec):
|
2021-06-19 17:44:14 +00:00
|
|
|
"""Handles Small size in Jpeg format"""
|
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
processors = [ResizeToFit(100, 100)]
|
2021-05-24 14:33:40 +00:00
|
|
|
format = "JPEG"
|
|
|
|
options = {"quality": 95}
|
2021-05-24 14:15:08 +00:00
|
|
|
|
2021-05-24 14:40:25 +00:00
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
class BookMediumWebp(ImageSpec):
|
2021-06-19 17:44:14 +00:00
|
|
|
"""Handles Medium size in Webp format"""
|
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
processors = [ResizeToFit(150, 150)]
|
2021-05-24 14:33:40 +00:00
|
|
|
format = "WEBP"
|
|
|
|
options = {"quality": 95}
|
2021-05-24 14:15:08 +00:00
|
|
|
|
2021-05-24 14:40:25 +00:00
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
class BookMediumJpg(ImageSpec):
|
2021-06-19 17:44:14 +00:00
|
|
|
"""Handles Medium size in Jpeg format"""
|
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
processors = [ResizeToFit(150, 150)]
|
2021-05-24 14:33:40 +00:00
|
|
|
format = "JPEG"
|
|
|
|
options = {"quality": 95}
|
2021-05-24 14:15:08 +00:00
|
|
|
|
2021-05-24 14:40:25 +00:00
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
class BookLargeWebp(ImageSpec):
|
2021-06-19 17:44:14 +00:00
|
|
|
"""Handles Large size in Webp format"""
|
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
processors = [ResizeToFit(200, 200)]
|
2021-05-24 14:33:40 +00:00
|
|
|
format = "WEBP"
|
|
|
|
options = {"quality": 95}
|
2021-05-24 14:15:08 +00:00
|
|
|
|
2021-05-24 14:40:25 +00:00
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
class BookLargeJpg(ImageSpec):
|
2021-06-19 17:44:14 +00:00
|
|
|
"""Handles Large size in Jpeg format"""
|
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
processors = [ResizeToFit(200, 200)]
|
2021-05-24 14:33:40 +00:00
|
|
|
format = "JPEG"
|
|
|
|
options = {"quality": 95}
|
2021-05-24 14:15:08 +00:00
|
|
|
|
2021-05-24 14:40:25 +00:00
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
class BookXLargeWebp(ImageSpec):
|
2021-06-19 17:44:14 +00:00
|
|
|
"""Handles XLarge size in Webp format"""
|
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
processors = [ResizeToFit(250, 250)]
|
2021-05-24 14:33:40 +00:00
|
|
|
format = "WEBP"
|
|
|
|
options = {"quality": 95}
|
2021-05-24 14:15:08 +00:00
|
|
|
|
2021-05-24 14:40:25 +00:00
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
class BookXLargeJpg(ImageSpec):
|
2021-06-19 17:44:14 +00:00
|
|
|
"""Handles XLarge size in Jpeg format"""
|
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
processors = [ResizeToFit(250, 250)]
|
2021-05-24 14:33:40 +00:00
|
|
|
format = "JPEG"
|
|
|
|
options = {"quality": 95}
|
2021-05-24 14:15:08 +00:00
|
|
|
|
2021-05-24 14:40:25 +00:00
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
class BookXxLargeWebp(ImageSpec):
|
2021-06-19 17:44:14 +00:00
|
|
|
"""Handles XxLarge size in Webp format"""
|
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
processors = [ResizeToFit(500, 500)]
|
2021-05-24 14:33:40 +00:00
|
|
|
format = "WEBP"
|
|
|
|
options = {"quality": 95}
|
2021-05-24 14:15:08 +00:00
|
|
|
|
2021-05-24 14:40:25 +00:00
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
class BookXxLargeJpg(ImageSpec):
|
2021-06-19 17:44:14 +00:00
|
|
|
"""Handles XxLarge size in Jpeg format"""
|
|
|
|
|
2021-05-24 14:15:08 +00:00
|
|
|
processors = [ResizeToFit(500, 500)]
|
2021-05-24 14:33:40 +00:00
|
|
|
format = "JPEG"
|
|
|
|
options = {"quality": 95}
|
2021-05-24 14:15:08 +00:00
|
|
|
|
2021-05-24 14:40:25 +00:00
|
|
|
|
2021-05-24 14:33:40 +00:00
|
|
|
register.generator("bw:book:xsmall:webp", BookXSmallWebp)
|
|
|
|
register.generator("bw:book:xsmall:jpg", BookXSmallJpg)
|
|
|
|
register.generator("bw:book:small:webp", BookSmallWebp)
|
|
|
|
register.generator("bw:book:small:jpg", BookSmallJpg)
|
|
|
|
register.generator("bw:book:medium:webp", BookMediumWebp)
|
|
|
|
register.generator("bw:book:medium:jpg", BookMediumJpg)
|
|
|
|
register.generator("bw:book:large:webp", BookLargeWebp)
|
|
|
|
register.generator("bw:book:large:jpg", BookLargeJpg)
|
|
|
|
register.generator("bw:book:xlarge:webp", BookXLargeWebp)
|
|
|
|
register.generator("bw:book:xlarge:jpg", BookXLargeJpg)
|
|
|
|
register.generator("bw:book:xxlarge:webp", BookXxLargeWebp)
|
|
|
|
register.generator("bw:book:xxlarge:jpg", BookXxLargeJpg)
|