Skip to Content
Odoo मेन्यू
  • Sign in
  • मुफ़्त में आज़माएं
  • ऐप्लिकेशन
    फ़ाइनेंस
    • अकाउंटिंग
    • इनवॉइसिंग
    • एक्सपेंस
    • स्प्रेडशीट (बीआई)
    • डॉक्यूमेंट्स
    • साइन
    सेल्स
    • सीआरएम
    • सेल्स
    • पीओएस शॉप
    • पीओएस रेस्टोरेंट
    • सब्सक्रिप्शन
    • रेंटल
    वेबसाइट
    • वेबसाइट बिल्डर
    • ई-कॉमर्स
    • ब्लॉग
    • फ़ोरम
    • लाइव चैट
    • ई-लर्निंग
    सप्लाई चेन
    • इन्वेंट्री
    • मैन्युफ़ैक्चरिंग
    • पीएलएम
    • परचेज़
    • मेंटेनेंस
    • क्वालिटी
    मानव संसाधन
    • कर्मचारी
    • रिक्रूटमेंट
    • टाइम ऑफ़
    • अप्रेज़ल
    • रेफ़रल
    • फ़्लीट
    मार्केटिंग
    • सोशल मार्केटिंग
    • ईमेल मार्केटिंग
    • एसएमएस मार्केटिंग
    • इवेंट
    • मार्केटिंग ऑटोमेशन
    • सर्वे
    सेवाएं
    • प्रोजेक्ट
    • टाइमशीट
    • फ़ील्ड सर्विस
    • हेल्पडेस्क
    • प्लानिंग
    • अपॉइंटमेंट
    प्रॉडक्टिविटी
    • डिस्कस
    • अप्रूवल
    • आईओटी
    • वीओआईपी
    • नॉलेज
    • WhatsApp
    तीसरे पक्ष के ऐप्लिकेशन Odoo स्टूडियो Odoo क्लाउड प्लेटफ़ॉर्म
  • इंडस्ट्री
    रीटेल
    • बुक स्टोर
    • क्लोदिंग स्टोर
    • फ़र्नीचर स्टोर
    • ग्रॉसरी स्टोर
    • हार्डवेयर स्टोर
    • टॉय स्टोर
    Food & Hospitality
    • बार और पब
    • रेस्टोरेंट
    • फ़ास्ट फ़ूड
    • Guest House
    • बेवरिज डिस्ट्रीब्यूटर
    • होटल
    रियल एस्टेट
    • Real Estate Agency
    • आर्किटेक्चर फ़र्म
    • कंसट्रक्शन
    • एस्टेट मैनेजमेंट
    • गार्ड्निंग
    • प्रॉपर्टी ओनर असोसिएशन
    कंसल्टिंग
    • अकाउंटिंग फ़र्म
    • Odoo पार्टनर
    • मार्केटिंग एजेंसी
    • लॉ फ़र्म
    • टैलेंट ऐक्विज़िशन
    • ऑडिट & सर्टिफ़िकेशन
    मैन्युफ़ैक्चरिंग
    • टेक्सटाइल
    • Metal
    • फ़र्नीचर
    • फ़ूड
    • Brewery
    • कॉर्पोरेट गिफ़्ट
    हेल्थ & फिटनेस
    • स्पोर्ट्स क्लब
    • आईवियर स्टोर
    • फिटनेस सेंटर
    • वेलनेस प्रैक्टिशनर
    • फॉर्मेसी
    • हेयर सैलून
    Trades
    • Handyman
    • आईटी हॉर्डवेयर और सपोर्ट
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    अन्य
    • Nonprofit Organization
    • एन्वायरमेंटल एजेंसी
    • बिलबोर्ड रेंटल
    • फ़ोटोग्राफी
    • बाइक लीजिंग
    • सॉफ़्टवेयर रीसेलर
    Browse all Industries
  • कम्यूनिटी
    सीखें
    • ट्यूटोरियल्स
    • दस्तावेज़
    • सर्टिफ़िकेशन
    • ट्रेनिंग
    • ब्लॉग
    • पॉडकास्ट
    शिक्षा को बढ़ावा दें
    • एजुकेशन प्रोग्राम
    • स्केल अप! बिजनेस गेम
    • Odoo के ऑफ़िस में आएं
    सॉफ़्टवेयर पाएं
    • डाउनलोड
    • वर्शन की तुलना करें
    • रिलीज़
    साथ मिलकर काम करें
    • Github
    • फ़ोरम
    • इवेंट
    • अनुवाद
    • पार्टनर बनें
    • Services for Partners
    • अपना अकाउंटिंग फ़र्म रजिस्टर करें
    सेवाएं पाएं
    • पार्टनर ढूंढें
    • अकाउंटेंट खोजें
    • सलाहकार की मदद लें
    • इम्प्लिमेंटेशन सेवाएं
    • कस्टमर रेफ़रेंस
    • सहायता
    • अपग्रेड
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    डेमो देखें
  • कीमत
  • सहायता

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • सीआरएम
  • e-Commerce
  • लेखांकन
  • इन्वेंटरी
  • PoS
  • प्रोजेक्ट
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
Help

Products' images URL

Subscribe

Get notified when there's activity on this post

This question has been flagged
publicintergationurlimages
6 Replies
45166 Views
Avatar
arthur

Hello, I am trying to sync odoo with an existing ecommerce platform. Right now, I am trying to upload products from odoo to this platform. In order to upload the product image, I have to send the image url.

I tried to do so through the path /web/image?model=product.template&id={{product.id}}&field=image
But it didn't work, since the url doesn't return the image file.

I also tried to use the path /web/image/product.template/{{product.id}}/image
In this case it didn't work either, because of a 403 - Forbidden error, which I also get when trying to make a GET request using Postman.

Is there a way I can make this URL public? (because the ecommerce I and integrating with, I can't pass access data or such). If not, is there any other URL I might use?

1
Avatar
Discard
Avatar
Yenthe Van Ginneken (Mainframe Monkey)
Best Answer

Hi Arthur,

By default the images are stored in the database in a base64 format so they're not really stored as an attachment. If you have the image as an attachment on the product you can create a public URL for it as you can look at the paths from the fields 'local_url' and 'website_url' (from the model ir.attachment) to make a full URL to your image(s). This way you could provide links but then you have to attach the images as an attachment on the products. I've added those two fields to the view from the ir.attachment model so that you can see how the path is built:


If you combine that path (so /web/image/2259?unique=4db4955a92a769b04b4320af6235fdccf8cdf016) with the basic URL of your website (in this case http://422032-11-0-fa8705.runbot15.odoo.com) you'll get a full URL to the image. Being http://422032-11-0-fa8705.runbot15.odoo.com/web/image/2259?unique=4db4955a92a769b04b4320af6235fdccf8cdf016 in this sample. The result after you navigate to this URL is your image:


I can't imagine that you're trying to connect with another ecommerce tool that has literally no way to get values through any protocol from another instance though. Are you really sure you can't? You can use xml-rpc to easily get the base64 images from any product in a matter of seconds.

Regards,
Yenthe

2
Avatar
Discard
arthur
Author

Thanks for your response Yenthe, it helped clarifying things.

I was able to create attachments with the following function:

class ProductTemplate(models.Model):

_inherit = 'product.template'

@api.multi

def create_image_attachment(self, product):

image = self.env['ir.attachment'].create(dict(

datas_fname="Test.png",

name="Image - " + product.name,

datas=product.image,

mimetype='application/png',

res_model='product.template',

res_id=product.id,

))

return image

If I go to the product.template form view, I can download the attachments created and they are download correctly. However, if i try to download the image through the 'image_attachment.local_url', the file I download doesn't have the right name or extension.

Any idea of what I am missing?

Thanks

arthur
Author

Just managed to fix it. I just had to mimetype to 'image/jpeg'.

Still, the path provided by .local_url is not public. Is there a way I can make it public?

arthur
Author

Just managed to fix it. I just had to mimetype to 'image/jpeg'.

Still, the path provided by .local_url is not public. Is there a way I can make it public?

Kestutis Urbonas

Trying to import products from odoo export file. Image field is there. Getting error: Found invalid image data, images should be imported as either URLs or base64-encoded data.

Any idea ?

I though that that field is base64 encoded. Am I wrong ?

Avatar
Ahmad Rahban
Best Answer

I managed to solve this issue by doing it manually.. I used a free app called "image from url" and pasted the image url there and then exported the value of the image_from_url field which's the image link!


0
Avatar
Discard
Avatar
fudo
Best Answer

Currently, to get the product image as url, we could use:

from odoo.tools.image import image_data_uri

product_image = image_data_uri(product.image_1920)

In my case,  product.image_1920 is the column of saved product image, you can replace it with your column to make it work.

Note: after get  product_image, you can see it still look like base64 encrypted format, but it's not, try to paste it to web browser such as Chrome, and you will see the image appear.

0
Avatar
Discard
Grzegorz Goraj

I can see the binary of the image...

Avatar
Stefano Savanelli
Best Answer

/

By default the images are **NOT** stored in the database, but in filestore.

In ir_attachment table for images  by  default  type  field  is  set  to  "binary"  and  store_fname field is  set  to  filestore path of the file.

Other behavior  can  be  set  by  config  or  by  addons.

0
Avatar
Discard
Avatar
arthur
Author Best Answer

I managed to create the attachment and get its .local_url. However the route is also private. Is there a way can make it public?

0
Avatar
Discard
Avatar
Jhe
Best Answer

I have same issue, is there any solution?

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
Get image (field Binary) for public user
public images
Avatar
0
अप्रैल 24
1884
How to create a public url to download an attachment? Solved
public attachment url download
Avatar
1
फ़र॰ 17
24328
Products image from URL, csv.
product url images ascii
Avatar
Avatar
2
दिस॰ 16
5192
[ODOO13] Create a link to the res partner image
res.partner attachments url images Odoo13.0
Avatar
0
अप्रैल 21
3849
Suggestion for image management for the website, mailings...
images
Avatar
0
जून 25
3425
कम्यूनिटी
  • ट्यूटोरियल्स
  • दस्तावेज़
  • फ़ोरम
ओपन सोर्स
  • डाउनलोड
  • Github
  • रनबॉट
  • अनुवाद
सेवाएं
  • Odoo.sh Hosting
  • सहायता
  • अपग्रेड
  • कस्टम डेवलपमेंट्स
  • शिक्षा
  • अकाउंटेंट खोजें
  • पार्टनर ढूंढें
  • पार्टनर बनें
हमारे बारे में
  • हमारी कंपनी
  • ब्रांड ऐसेट
  • संपर्क करें
  • नौकरियां
  • इवेंट
  • पॉडकास्ट
  • ब्लॉग
  • ग्राहक
  • लीगल • गोपनीयता
  • सुरक्षा
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo, बिज़नेस से जुड़े ऐप्लिकेशन का एक कलेक्शन है जो ओपन सोर्स पर आधारित है. इसमें आपकी कंपनी की हर ज़रूरत के लिए ऐप्लिकेशन हैं. जैसे, सीआरएम, ई-कॉमर्स, अकाउंटिंग, इन्वेंट्री, पॉइंट ऑफ़ सेल, प्रोजेक्ट मैनेजमेंट वगैरह.

Odoo की सबसे बड़ी खासियत है कि यह इस्तेमाल करने में बहुत आसान है और यह पूरी तरह से इंटिग्रेट किया हुआ है.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now