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.

86 lines
2.5 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. It is useful for modules such as `website_blog_excerpt_img
  10. <https://github.com/OCA/website/tree/9.0/website_blog_excerpt_img>`_: blog list shows the first
  11. image included in the post if haven't a defined cover image.
  12. Usage
  13. =====
  14. This module just adds a technical utility, but nothing for the end user.
  15. If you are a developer and need this utility for your module, see these
  16. examples and read the docs inside the code.
  17. Python example::
  18. @api.multi
  19. def some_method(self):
  20. # Get images from an HTML field
  21. imgs = self.env["ir.fields.converter"].imgs_from_html(self.html_field)
  22. for url in imgs:
  23. # Do stuff with those URLs
  24. pass
  25. QWeb example::
  26. <!-- Extract first image from a blog post -->
  27. <t t-foreach="env['ir.fields.converter']
  28. .imgs_from_html(blog_post.content, 1)"
  29. t-as="url">
  30. <img t-att-href="url"/>
  31. </t>
  32. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  33. :alt: Try me on Runbot
  34. :target: https://runbot.odoo-community.org/runbot/149/12.0
  35. Known issues / Roadmap
  36. ======================
  37. * The regexp to find the URL could be better.
  38. Bug Tracker
  39. ===========
  40. Bugs are tracked on `GitHub Issues
  41. <https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
  42. check there if your issue has already been reported. If you spotted it first,
  43. help us smashing it by providing a detailed and welcomed feedback.
  44. Credits
  45. =======
  46. Contributors
  47. ------------
  48. * Jairo Llopis <jairo.llopis@tecnativa.com>
  49. * Vicent Cubells <vicent.cubells@tecnativa.com>
  50. * Dennis Sluijk <d.sluijk@onestein.nl>
  51. * Cristina Martin R. <cristina.martin@tecnativa.com>
  52. Do not contact contributors directly about support or help with technical issues.
  53. Maintainer
  54. ----------
  55. .. image:: https://odoo-community.org/logo.png
  56. :alt: Odoo Community Association
  57. :target: https://odoo-community.org
  58. This module is maintained by the OCA.
  59. OCA, or the Odoo Community Association, is a nonprofit organization whose
  60. mission is to support the collaborative development of Odoo features and
  61. promote its widespread use.
  62. To contribute to this module, please visit https://odoo-community.org.