I have a suggestion about rebuilding the method for rebuilding derivative images. This is sort of a follow up to #516064: Out of memory error due to uploading large file; can't delete node and #226121: don't manipulate images on hook_load, but I was asked to start a new issue thread.
It seems like rebuilding derivative images would be a perfect candidate to be a triggered action. It could be set to hook_view() by default, but users could configure it to be triggered on hook_update() and/or hook_insert(). This would be through an implementation of hook_action_info(). This would solve problems with PHP timing out in the case of too-large images (where the node can't be deleted) and batch processing.
Is this a good idea?
Comments
Comment #1
joachim commentedInteresting...
As I said over there, it doesn't solve the problem of figuring out where in the node lifecycle this needs to happen.
I don't know much about actions. How would using an action solve PHP timeout problems?
Comment #2
Karlheinz commentedIt technically wouldn't solve any timeout problems, but it would allow users to control image rebuilding if something went wrong.
If a user had accidentally uploaded a 10M image, they could stop image rebuilding while they deleted the node. Or, if they used batch uploading, they could have image rebuilding happen on node view and not node creation.
In other modules, automatic actions (e.g. sending email) are done either through cron.php or through trigger.module. Since the image module currently works by automatically rebuilding images on node_load, it seems like a trigger would be closer to what you have in mind.
But it's just a thought.
Comment #3
joachim commentedYou can already rebuild images for specific images in content admin, or on the node itself.
I'd be happy to expose this as an action that users can set up, but I am not sure about the idea of changing the built-in behaviour to something that's just a setting.
Comment #4
Karlheinz commentedChanging it from a built-in behavior to a user-defined behavior (which defaults to the same behavior as what is currently built-in) would give users more options, should they need them.
In practice, I suggested this mostly as a "nuclear option" in case something goes horribly wrong, as in what happened in those issues I cited.
I'm pretty sure the way Drupal was intended to work, is for node_load to simply get information about a node, and not do any processing; this would help separate the two ("model" from "controller").
But it may indeed be more trouble than it's worth.
Comment #5
joachim commentedI can barely understand when this rebuilding currently happens and when it ought to happen.
I really don't think users will want this choice imposed on them!
Also, to provide the current behaviour as a default, we'd need to force users to enable Trigger module (as far as I can tell). Introducing an extra dependency, even on a core module, is not something I think we should do.
So to sum up: sure, if someone wants to write a patch to expose rebuilding a node's derivatives as an action, then I will review the patch and likely commit it.
Comment #6
stieglitz commentedIs this something that would be possible to do through views_bulk_operations?
Comment #7
joachim commentedviews_bulk_operations uses core node actions as well as ones exposed to triggers -- so yes, if someone writes a patch, then this will become available to VBO.
Comment #8
sunGiven that (a different) Image module is in Drupal 7 core, the contrib Image module remains minimally maintained now. It won't see any new features. Instead, we're trying hard to make upgrades to D7 work. See project page for details. Thanks!