You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.2 KiB

  1. .. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
  2. :target: https://www.gnu.org/licenses/agpl
  3. :alt: License: AGPL-3
  4. ==========================
  5. Image URLs from HTML field
  6. ==========================
  7. This module includes a method that extracts image URLs from any chunk of HTML,
  8. in appearing order.
  9. Usage
  10. =====
  11. This module just adds a technical utility, but nothing for the end user.
  12. If you are a developer and need this utility for your module, see these
  13. examples and read the docs inside the code.
  14. Python example::
  15. @api.multi
  16. def some_method(self):
  17. # Get images from an HTML field
  18. imgs = self.env["ir.fields.converter"].imgs_from_html(self.html_field)
  19. for url in imgs:
  20. # Do stuff with those URLs
  21. pass
  22. QWeb example::
  23. <!-- Extract first image from a blog post -->
  24. <t t-foreach="env['ir.fields.converter']
  25. .imgs_from_html(blog_post.content, 1)"
  26. t-as="url">
  27. <img t-att-href="url"/>
  28. </t>
  29. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  30. :alt: Try me on Runbot
  31. :target: https://runbot.odoo-community.org/runbot/149/11.0
  32. Known issues / Roadmap
  33. ======================
  34. * The regexp to find the URL could be better.
  35. Bug Tracker
  36. ===========
  37. Bugs are tracked on `GitHub Issues
  38. <https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
  39. check there if your issue has already been reported. If you spotted it first,
  40. help us smashing it by providing a detailed and welcomed feedback.
  41. Credits
  42. =======
  43. Contributors
  44. ------------
  45. * Jairo Llopis <yajo.sk8@gmail.com>
  46. * Vicent Cubells <vicent.cubells@tecnativa.com>
  47. * Dennis Sluijk <d.sluijk@onestein.nl>
  48. Do not contact contributors directly about support or help with technical issues.
  49. Maintainer
  50. ----------
  51. .. image:: https://odoo-community.org/logo.png
  52. :alt: Odoo Community Association
  53. :target: https://odoo-community.org
  54. This module is maintained by the OCA.
  55. OCA, or the Odoo Community Association, is a nonprofit organization whose
  56. mission is to support the collaborative development of Odoo features and
  57. promote its widespread use.
  58. To contribute to this module, please visit https://odoo-community.org.