This question has been flagged
3 Replies
12320 Views

How can I store the product images in the filesystem instead of in the DB?

I tried adding product_image.location with value file:///filestore to my system parameters but that didn't work. Also ir_attachment.location file:///filestore has no effect.

Avatar
Discard
Author

@ Stephen. I cannot comment on your answer. I followed your link but nothing is working. moreover there are so many solutions I don't know which is the latest working. As far as I understood it schuld be Key : ir_attachment.location Value: file When I do that there is a file created in my filestore folder. /opt/odoo/odoo-server/filestore/filestore/dbname/41/41e8284229e6b03a10a150dfbd1388564236c284 Content is: PNG Image: ‘41e8284229e6b03a10a150dfbd1388564236c284’ pixelWidth: 68 pixelHeight: 68 Thats an attachement I added to a product as a internal note Apart from the fact that it doesn't store anything useful, the question for me is how to store product images on the filesystem. I tried importing them but I just have to much pictures. The csv file with the base64 encoded pictures is 1GB. When I create a new product with the above settings activated nothing happens. Picture is a blob in the product.template table

Best Answer

Thanks to tsabi https://github.com/odoo/odoo/issues/2633 

In Odoo 8 ir_attachment image store in filesystem system parameters has been changed.
Odoo using the menu Parameters --> System Parameters
Create new record with the details Key:  file and Value: file:///filestore
and in the openerp-server.conf File set the data_dir path
Example,
   data_dir = D:\filestore

 

Odoo product image store in file system the below link may be useful:-
http://www.maxmakedesign.co.uk/development/2014/odoo-binary-field/

In order to have more flexible file serving functionality within Odoo,
you can swap out binary fields for a functional field that returns
the contents of your file.

 

 

Avatar
Discard
Author Best Answer

Thank you for your answer but unfortunately I cannot get it to work

My /etc/odoo-server.conf has this entry data_dir = /opt/odoo/odoo-server/files. I set permissions to 755

Odoo created 3 folders inside. sessions, addons, filestore

After restarting the whole server, odoo still saves product pictures and attachements as binary in the DB

@ Stephen. I cannot comment on your answer. I followed your link but nothing is working. moreover there are so many solutions I don't know which is the latest working. As far as I understood it schuld be Key : ir_attachment.location Value: file When I do that there is a file created in my filestore folder.

/opt/odoo/odoo-server/filestore/filestore/dbname/41/41e8284229e6b03a10a150dfbd1388564236c284

Content is:

PNG Image: ‘41e8284229e6b03a10a150dfbd1388564236c284’

pixelWidth: 68

pixelHeight: 68

Thats an attachement I added to a product as a internal note Apart from the fact that it doesn't store anything useful, the question for me is how to store product images on the filesystem. I tried importing them but I just have to much pictures. The csv file with the base64 encoded pictures is 1GB. When I create a new product with the above settings activated nothing happens. Picture is a blob in the product.template table

Avatar
Discard
Best Answer

Hi Af,

Odoo can be configured to store the attachments in the Database or on the filesystem.  You can read this classic forum post on how to change from one to the other.  There is also a user developed script to help move the attachments one time.

Avatar
Discard