Generating images in different size
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 HostelStudent(models.Model): _name = "hostel.student" _description = "Hostel Student Information" _inherit = ["image.mixin"]
The mixin will automatically add five new fields to the hostel student 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...