Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

Products' images URL

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
publicintergationurlimages
6 Antwoorden
45188 Weergaven
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
Annuleer
Avatar
Yenthe Van Ginneken (Mainframe Monkey)
Beste antwoord

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
Annuleer
arthur
Auteur

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
Auteur

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
Auteur

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
Beste antwoord

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
Annuleer
Avatar
fudo
Beste antwoord

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
Annuleer
Grzegorz Goraj

I can see the binary of the image...

Avatar
Stefano Savanelli
Beste antwoord

/

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
Annuleer
Avatar
arthur
Auteur Beste antwoord

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
Annuleer
Avatar
Jhe
Beste antwoord

I have same issue, is there any solution?

0
Avatar
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
Get image (field Binary) for public user
public images
Avatar
0
apr. 24
1884
How to create a public url to download an attachment? Opgelost
public attachment url download
Avatar
1
feb. 17
24333
Products image from URL, csv.
product url images ascii
Avatar
Avatar
2
dec. 16
5196
[ODOO13] Create a link to the res partner image
res.partner attachments url images Odoo13.0
Avatar
0
apr. 21
3853
Suggestion for image management for the website, mailings...
images
Avatar
0
jun. 25
3427
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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