Objective: Extract image (ideally into a new field) from an existing text field in a custom entity with views handler (civicrm view or civicrm_entity).

Scenario: HTML fields often has an image or multiple images embedded. In this case, the content is sourced from a civicrm external entity using civicrm views (could also be done using civicrm_entity module). Views provides text field filters and can strip html tags, but I only want to extract one or more images from the html. This can then be displayed as a seperate field in views (either as a new / generated field) or reusing the description field and stripping out everything else.

Notes: This seems easy, but the field formatter needs to work with remote urls. I tried the Image Resize Filter which works on remote urls, but i need to also strip the rest of the text. This does not actually create a new field, and is pretty ugly, but can work.

Modules considered / reviews: https://www.drupal.org/project/image_link_formatter - not a node, only avail as view https://www.drupal.org/project/image_importer - like idea of importing as "Drupal" image but no easy way to link embeded image to file system

Discusssions: https://www.drupal.org/node/1045712 https://drupal.stackexchange.com/questions/138961/get-images-from-textfield-and-save-them-in-filefield Images within content of page but not separate fields


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.