Generating differently sized images
Large images can be troublesome for any website. They increase the size of web pages and consequently make them slower as a result. This leads to bad SEO rankings and visitor loss. In this recipe, we will explore how you can create images of different sizes; by using the right images, you can reduce the web page size and improve the page loading time.
How to do it...
You will need to inherit image.mixin
in your model. Here is how you can add image.mixin
to your model:
class LibraryBook(models.Model): _name = 'library.book' _description = 'Library Book' _inherit = ['image.mixin']
The mixin will automatically add five new fields to the books
model to store images of different sizes. See the How it works… section to learn about all five fields.
How it works...
The image.mixin
instance will automatically add five new binary...