Download & Extend

Method to delete all images at once

Project:ImageField
Version:6.x-3.9
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Is there a way to implement this, that someone can point me towards?

I'd like to setup a node edit form with a button to 'remove all' existing images. Is there an existing function, or best way to approach this, to make sure I find and remove the correct info?

Thanks

Comments

#1

Any idea?

#2

Category:feature request» support request
Status:active» fixed

At this point, we probably won't be adding new features to ImageField module. Code-wise, you simply need to remove the items from the $node object and the corresponding files will be deleted upon calling node_save().

$node = node_load($nid);
$node->field_image = array();
node_save($node);

#3

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here