Closed (fixed)
Project:
Image
Version:
6.x-1.x-dev
Component:
image.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Nov 2008 at 19:28 UTC
Updated:
5 Jan 2009 at 22:10 UTC
Jump to comment: Most recent file
Comments
Comment #1
egfrith commentedThis bug report relates to a discussion that bwynants and I are having in the image_pub issue queue at #270085: Port to Drupal 6.
The question is whether to create an image node using
image_create_node_from()or something like this code, which uses the form api drupal_execute() function:The advantage of image_create_from() over using drupal_execute() is that we think the name of the image_create_node_form() function is less likely to change than the names of the fields in the image_form.
The disadvantages of image_create_from() versus using drupal_execute() are that:
1. image_create_from() does not return any information about the error (as mentioned in comment #1), and that
2. it does not appear to check the sizes of the images.
Comment #2
bwynants commentedoops the link in the description should be http://drupal.org/node/270085#comment-1117755
Comment #3
olarin commentedOn a related note - pardon my ignorance here, but does image_create_node_from really need to check for user permissions at all? I ask because I'm trying to call it from a cron hook in a custom module I'm developing, and this is causing me a bit of a headache because it's not clear what user, if any, cron runs as; if I manually run cron then it has root permissions and all is well, but when cron runs automatically it generates access_denied errors. image_create_node_from is not a function that ever gets directly called by a user, and it seems to me that it would make more sense to be checking for proper user permissions outside this function, in whatever functions call it (image_attach_validate, for instance); that would make this function itself more flexible in how it can be used by other modules (for instance, in cron hooks...).
Comment #4
drewish commentedyou could make the argument either way about checking the permissions but i think bwynants is correct that it should return FALSE.
committing the attached to HEAD.