OCA / storage

GNU Affero General Public License v3.0
72 stars 161 forks source link

fs_product_multi_image from existing db #330

Closed bealdav closed 2 months ago

bealdav commented 9 months ago

Is your feature request related to a problem? Odoo generate product images (image_128, ..._256, 512, 1024, 1920) for its own usages in its modules and fs_storage modules may use images related to the same products for its own purposes. How to conciliate these behaviors ?

Describe the solution you'd like After a record is created in fs.product.image (adding an image in tab Images in product) resulting with specific_image res_field in ir.attachment we could also trigger the standard odoo way to generate images (_128 to _1920) to serve both usages ?

If this solution is right I could try to make a PR.

I just would like feedbacks.

Describe alternatives you've considered I don't know any alternative to keep the 2 behaviors : the odoo way, and the storage way

Additional context My request is not about migrate product image data from the odoo way to the storage way

cc @lmignon @benwillig @tuantrantg @sbidoul @sebastienbeau

lmignon commented 9 months ago

@bealdav With fs_product_multi_image, when you upload an image, the original image is preserved as main_image and an image_medium is also generated to use as thumbnail (128x128) into odoo UI see https://github.com/OCA/storage/blob/16.0/fs_image/models/fs_image_mixin.py.

It's on purpose that I decided to only generate one thumbnail from the original image with a size of 128x128 since it's the common size used into the UI to display the image on forms and kanbans. After some research into the code, it seems that the others sizes are only used by the website addons and are therefore useless by default.

When this addon is used next to the shopinvader_search_egine_image addon you have to know that the images make available to the search engine are not the original ones. They are copies of the main image resized to the sizes configured on the search engine backend and named with an localized and SEO compliant name based on the name of the related product.

bealdav commented 9 months ago

Thanks a lot for this answer and all this huge work on this repo

lmignon commented 9 months ago

@bealdav TIL while diving into the odoo's code.... Images with extensions png,jpeg,bmp,tiff are resized in any case by default to 1920x1920 (see https://github.com/odoo/odoo/blob/17.0/odoo/addons/base/models/ir_attachment.py#L324 for details)

github-actions[bot] commented 3 months ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.