Node operation to bulk add watermarks

Luca O - July 17, 2008 - 22:06
Project:Image watermark
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

No idea if existed for 5.x, anyway i needed this node operation to quickly add my watermark in all the images already uploaded on my site.
So i wrote this (pretty useless to write a .patch, there are only few rows to add in watermark.module :P):

function watermark_node_operations() {
  $operations = array(
    'add_watermark' => array(
      'label' => t('Add watermark to images'),
      'callback' => 'watermark_operations_add',
    ),
  );
  return $operations;
}

function watermark_operations_add($nids) {
  foreach ($nids as $nid) {
    if ($node = node_load($nid)) {
      if ($node->type == 'image') {
        _watermark_apply($node);
      }
    }
  }
}

I hope this will be useful for someone, bye!

 
 

Drupal is a registered trademark of Dries Buytaert.