1

Every time a new node is published within a single content type, I wish to extract (not remove) all the images out from that node's body and save the URL(s) of the images in the database. I will then use the URLs to make a slideshow of the images on a separate node.

I have three questions:

  1. Which hook runs right before a node is published?
  2. What's the best way of saving those URLs in the database?
  3. Which Drupal function do I use to retrieve those URLs from the database?

1 Answer 1

1

Which book runs right before a node is published?

  • hook_node_update($node) The hook is invoked after the node is inserted/updated in the node table

What's the best way of saving those URLs in the database?

  • It totally depends upon your needs, Simply you will have to save in database in your own table(s).

Which Drupal function do I use to retrieve those URLs?

2
  • For the third question, I meant retrieving the saved URLs from the database. Sorry if I wasn't clear on that. But thanks for the hook and the advice to save them to a separate database - I'll look into that.
    – john010117
    Commented Jun 15, 2011 at 16:51
  • 1
    The first question was before the node is saved so the hook is [hook_node_presave[(api.drupal.org/api/drupal/modules--node--node.api.php/function/…) also, the hook_node_update isn't called while you insert a node.
    – tostinni
    Commented Jun 15, 2011 at 16:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.