This module extends the fs_image addon to support the creation and the storage of thumbnails for images. This module is a technical module and is not meant to be installed by end-users. It only provides a mixin to be used by other modules and a model to store the thumbnails.
auto_awesome What this module does
AI-generated from the code · Odoo 18.0This technical module lets Odoo generate and store resized thumbnail versions of images attached to records, and shows them on the attachment form and in a dedicated menu.
This is a technical module meant to be used by other modules rather than configured directly by end users. It provides a reusable "mixin" (a building block) that other modules can add to their own models so those models can produce thumbnails from an image.
What it does:
- For a given image, it can create resized copies at requested sizes (width and height) and store them as fs.thumbnail records linked to the original ir.attachment.
- Thumbnails are named using a base name plus the width and height, and the base name is cleaned up (slugified) so the same image and base name always map to the same set of thumbnails.
- It can look up existing thumbnails for an image and only create the missing sizes, avoiding duplicates.
- The output format can be forced through the system parameter fs_image_thumbnail.resize_format; otherwise the original image format is kept.
Where it appears in Odoo: - A menu "Fs Image Thumbnails" under the storage menu opens a list and form of all stored thumbnails. - The attachment form gains a "Thumbnails" section listing the thumbnails linked to that attachment. - Search and grouping are available by name, base name, mime type and attachment.
Business rules and behaviours: - An image must be attached to an attachment before thumbnails can be generated, otherwise an error is raised. - When several images are passed at once, a base name must be provided, otherwise an error is raised. - Thumbnails are deleted automatically when their original attachment is deleted. - Regular users can only read thumbnails; creation is done by the system.
Depends on
Required by other modules
Models and fields (3)
- fs.thumbnail · new model
- ir.attachment · extends an existing modelthumbnail_ids (Thumbnails)
- fs.image.thumbnail.mixin · new modelname, size_x (X size), size_y (Y size), mimetype, base_name (The base name of the thumbnail image (without extension)), attachment_id (Attachment)
Text generated by AI (DeepSeek) from reading the Odoo 18.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub
Availability by version
Reviewed: 2026-11-03Confirmation status: 3 confirmed, 6 with no information of 9 versions.
Sources · Odoo 18.0
Confirmed on 2026-11-03 in branch 18.0 of OCA/storage.
terminal Installation and usage
OCA documentation · Odoo 18.0Usage
Source · Odoo 18.0This addon provides a convenient way to get and create if not exists image thumbnails. All the logic is implemented by the abstract model fs.image.thumbnail.mixin. The main method is get_or_create_thumbnails which accepts a FSImageValue instance, a list of thumbnail sizes and a base name.
When the method is called, it will check if the thumbnail exists for the given sizes and base name. If not, it will create it.
The fs.thumbnail model provided by this addon is a concrete implementation of the abstract model fs.image.thumbnail.mixin. The motivation to implement all the logic in an abstract model is to allow developers to create their own thumbnail models. This could be useful if you want to store the thumbnails in a different storage since you can specify the storage to use by model on the fs.storage form view.
Creating / retrieving thumbnails is as simple as:
from odoo.addons.fs_image.fields import FSImageValue
# create an attachment with a image file
attachment = self.env['ir.attachment'].create({
'name': 'test',
'datas': base64.b64encode(open('test.png', 'rb').read()),
'datas_fname': 'test.png',
})
# create a FSImageValue instance for the attachment
image_value = FSImageValue(attachment)
# get or create the thumbnails
thumbnails = self.env['fs.thumbnail'].get_or_create_thumbnails(image_value, sizes=[(800,600), (400, 200)], base_name='my base name')If you've a model with a FSImage field, the call to get_or_create_thumbnails is even simpler:
from odoo import models
from odoo.addons.fs_image.fields import FSImage
class MyModel(models.Model):
_name = 'my.model'
image = FSImage('Image')
my_record = cls.env['my.model'].create({
'image': open('test.png', 'rb'),
})
# get or create the thumbnails
thumbnails = record.image.get_or_create_thumbnails(my_record.image,
sizes=[(800,600), (400, 200)], base_name='my base name')No verified information in OCA: Installation, Configuration.
Installation instructions, the distribution package, dependencies and configuration steps are not shown because they have not yet been verified in the module documentation for any version.
Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.