At long last, I have a working version finished. I've learned a lot about Drupal since I began this project, and I'm embarrassed about some of the code. For instance, I still need to theme it all, and optimize the code.

But anyway, it works, and some of you have been waiting a long time for it. (Here's the original post for reference.)

I don't have cvs working here yet, so you'll need to go here to pick up the image tab module. (The link is a 17kb zipped file.) It only works in 4.6 for now, but I promise, I will update it. (I need to have it working on some of my 4.7 sites at some point, so yes, I will eventually get around to that.)

I don't have a demonstration site set up yet. Also, I ended up disabling all the cool javascript that Jos contributed for now. (Jos, if you're still interested, we need to rethink how your sorting functions will work with the weights.)

TODO:
Put up a demonstration
Clean up code
Theme functions
Link in a basic css script
CVS to Drupal modules
Add Javascript hovering functions
Add Javascript editing functions
Update to 4.7

- Aaron Winborn

Advomatic, Web Design for Progressive Advocacy, Grassroots Movements, and Really Cool Causes

Digital Folk Art, which will someday be a cool blog about what it says

Spindowners, a text-based sci-fi mmorpg being developed with the upcoming Drupal Game module

Comments

jasonwhat’s picture

Sounds great. I'm excited about the new ways to make image inclusion easier for people. How does this differ from Upload Image module (http://drupal.org/project/upload_image) and Node Image Block (http://drupal.org/node/48676)? Can only admin's add images or can any user with permission add images to their own node?

aaron’s picture

Thanks for bringing those modules to my attention!

I started working on this back in September or October because I needed some of this capability. The Node Image Block wasn't available back then, and I haven't tried it yet, so I don't know how similar it is. At first glance, though it looks like a great module, I don't think it's what I needed, as it puts its images in a block, rather than attached to the node or teaser.

It looks like Upload Image was available, but I wasn't aware of it at the time. Again, I haven't looked at it. It looks much closer to what I had in mind originally, and if I'd noticed it (I was still new to Drupal at the time), I probably would have used that module as a base. I'll have to give it a look over.

I also recently noticed that the 4.7 inline module does a good job with automatically attaching images to nodes as well, although they are only uploaded as attachments and not converted to image nodes.

- Aaron Winborn

Advomatic (Web Design for Progressive Advocacy, Grassroots Movements, and Really Cool Causes)

jasonwhat’s picture

Can only admin's add images to a node? Or can any user with add images to their own node they created?

aaron’s picture

Currently, it's admins ('administer images') only atm. I think that it makes more sense for the perms to be either 'create images' or (less preferably) a new perm just for this. What are your thoughts about it?

BTW, I have a cvs version at http://cvs.drupal.org/viewcvs/drupal/contributions/modules/image_tab/, and will create a project page when it's just a little more stable.

- Aaron

Advomatic (Web Design for Progressive Advocacy, Grassroots Movements, and Really Cool Causes)

wellsy’s picture

definitely this needs to be another level of permission I believe for the majority of users.

You would not want to give most people admin image rights

wellsy

orchidsonline.com.au

aaron’s picture

I spent some time thinking about permissions this morning. And about how permissions work with various node types. Unfortunately, the permissions available for editing nodes are already complex, and I can't think of an easy way to see if someone has editing permissions for a node type. So that means that to do this properly, we probably also need to make permissions complex for images. Fortunately, that does give an added level of control to an administrator of a site.

Here's what I'm proposing:
If a user has 'administer images' rights, then it will act as it does now: they will be able to add & edit images to any nodes. However, there might be some cases where this conflicts with other permissions, so assigning that role should only be given to admin type roles. For instance, someone may be assigned 'administer images', but not 'create story' (or even 'edit own stories') -- this would allow them to have an image tab and thus associate images with an existing story that they may not otherwise edit. Unfortunately, I don't think there's an easy way to generically see if a user can edit a specific node type.

So the next level (and preferred way) of permissions will be to have 'create images for xxx', where xxx are the various node types. So, for instance, there would be 'create images for stories', 'create images for pages', 'create images for flexinode-13', etc. This can get hairy for a site with a dozen or more node types, but on the other hand, it does add a level of control. To make assigning the roles a little easier, I will only add the roles to the access page if image association has been enabled for a certain node type.

I can still see some problems with this, however. For instance, someone might be assigned 'create images for stories', but only 'edit own stories'. They would still be able to create images for all stories, even though they could only edit their own stories. But at least they wouldn't also be able to create images for pages.

I guess a more intelligent permissions system would check to see if the edit tab shows up at a specific node, and only add an image tab if a) the edit tab shows up, and b) the user has permission to create and associate images with that node type. But I'm not sure how to see if the edit tab shows up. Maybe there's a way to read the local task menu? But even then, what if the image_tab_menu is called before the node_type_menu?

Ack, this gets scarier and scarier. I think that for now, I'll just do what I laid out, and add 'create images for xxx' type permissions. For now, that means administrators will need to be judicious with the permissions. Maybe some other time I'll figure out how to handle the permissions a little more intelligently.

- Aaron

EDIT: Oh, and I guess they would also need 'create images' permissions for creating image nodes in the first place. I'll have to write out detailed instructions about how to assign the permissions, since someone could easily end up with effects they hadn't intended. And I have no idea how all this will work with Organic Groups or other node access modules. I'll just have to try it out. (And take a look at how OG handles this sort of thing, while I'm at it...)

Advomatic (Web Design for Progressive Advocacy, Grassroots Movements, and Really Cool Causes)

aaron’s picture

Ok, gave it some thought, and I think there are some valid reasons for using something like the module I'm writing over Upload Image or Inline. (I still haven't looked at the Node Image Block yet, so I'm not sure about that yet.)

Uploading is fine, but as far as I know, you can upload any file types, and not just images. Image Tab would only allow images, so might be preferable in some situations.

Also, this uses the built-in power of the Image module, which as far as I know, the various uploading modules don't. Although there is some basic functionality there for limiting file sizes, I believe, they don't offer as much control over thumbnails.

Also, using Images rather than Uploaded files, allows the images to also show up in galleries. (Although this might be a detriment in some applications; I've been trying to think about how to offer more control to users. For instance, someone might want to allow image associations, but limit the gallery taxonomies allowed for those added images. This would require more thought, and is beyond what I'm envisioning right now.)

I'd love to hear any ideas you might have about how this module would compare to similar existing modules, and how it might be improved.

- Aaron

Advomatic (Web Design for Progressive Advocacy, Grassroots Movements, and Really Cool Causes)

wellsy’s picture

I'm definitely glad there are people like you dealing with these complex issues.

I hope you are able to resolve it easily and if you get a test site up or have some code to test please let me know through my contact area or post again here.

wellsy

orchidsonline.com.au

jasonwhat’s picture

Actually, the upload image node does create and image node entry also, however, the image must be navigated to in order to add categorization and information. I think there is a place for both images that are image nodes, and those that are not. Some images that might supplement a post (like an icon or screenshot) may not make sense in any image gallery other than "miscellaneous."

wellsy’s picture

I have downloaded and it immediately works on my test site!

Is it possible to display thumbnail images in the node and not the original images?
So thumbnail is clicked which opens the fullsize image?
Plus a link back to the first node?

I don't seem to be able to do that with settings available.

No criticisms here only questions as to functionality.

Great module, thanks for your efforts!

wellsy

orchidsonline.com.au

aaron’s picture

I made the module with specific criteria in mind, which didn't need those capabilities. However, they are great ideas, so I'll add them to the todo list.

Thanks!
Aaron Winborn

Advomatic (Web Design for Progressive Advocacy, Grassroots Movements, and Really Cool Causes)