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.3 KiB

  1. .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
  2. :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
  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/8.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. <https://github.com/OCA/
  42. server-tools/issues/new?body=module:%20
  43. html_image_url_extractor%0Aversion:%20
  44. 8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
  45. Credits
  46. =======
  47. Contributors
  48. ------------
  49. * Jairo Llopis <yajo.sk8@gmail.com>
  50. Maintainer
  51. ----------
  52. .. image:: https://odoo-community.org/logo.png
  53. :alt: Odoo Community Association
  54. :target: https://odoo-community.org
  55. This module is maintained by the OCA.
  56. OCA, or the Odoo Community Association, is a nonprofit organization whose
  57. mission is to support the collaborative development of Odoo features and
  58. promote its widespread use.
  59. To contribute to this module, please visit https://odoo-community.org.