Closed (won't fix)
Project:
Flag
Version:
6.x-1.x-dev
Component:
Flag core
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Apr 2009 at 06:34 UTC
Updated:
14 Sep 2009 at 12:59 UTC
Is it already possible to flag files? It would be interesting to use Flag and Flag Weights with filefield / imagefield for such things as cover images, custom sorting, favorite images, mark people in image like on facebook, etc..
Comments
Comment #1
quicksketchThe potential to flag files is already there, as the Flag API can be extended to support any kind of object. However, such functionality will not be built into the core Flag module. Maintaining users, comments, and nodes is quite enough for the core project. See #299722: Possibility to Flag Taxonomy Terms / Taxonomy Integration for an implementation supporting the flagging taxonomy terms (which also won't be added to the core module).
Comment #2
frankcarey commentedFYI: I'm working on a flag_file module right now. Using the taxonomy module as a model. I need to use this to flag images, but I figure dealing with files directly is simpler and more universal. The aasumption has to be that the file is located in drupal's files table. Will post questions and any code i come up with.
Comment #3
frankcarey commentedSo, it seems for my purpose, a flag_filefield might be more appropriate. What I need is to add additional flags to the filefield widget. (Choosing one or multiple uploaded images as the feature image). We could do this by dragging a photo to position 0 (1st), but what if you want to have multiple featured images (display larger than thumbnail).
Seems this would alleviate the need for 2 imagefields to accomplish the distinction , and would also provide better ui since the user could enable and disable an image as "featured", not delete and re-upload. Thought and suggestions welcome (especially if anyone knows of a module doing this already)
Comment #4
frankcarey commentedThinking out loud: Might be able to have a flag_field, or flag_multivalue for other use cases. Say you want to have multiple fields like phone number, address, cities I've lived in, and you wanted to designate one if the multiples as the preferred, current, displayed, etc.
Comment #5
frankcarey commentedHmmm.. so here's the rub :) It looks like flag can only store whether some content_id (uid, nid, tid) has been flagged or not, but it can't give you any context for it other than what user flagged it (and maybe timestamp?). So this, by itself, won't work very well for things that have multiple value fields where you would probably want to store a delta, or some other id in addition to say the node id.
Images (filefield) would work where you could flag a particular image based on it's fid (file id), but you won't know which node it applies to if it is used in more than one node.
quicksketch, you are the maintainer of both flag and filefield, right? any suggestions here?
Comment #6
scroogie commentedCan't you just use the fid as content_id? I don't think it's mandatory that content_id is a nid.
Comment #7
frankcarey commentedyes, fid would be the way to do, the issue lies in a use case where you want to flag a file in the context of a node. If you wanted to flag offensive pictures say, this is fine and I'm implementing that solution (or at least trying to). But lets say you have a node with 8 imagefield images and you want to use the flag module to designate one of them as the "main" image. I think you need to know what the nid is too when you store this. the files table doesn't store nid so you have 2 joins...
$node -> $files -> $flag
Idk , I guess that might work... what do you think?
Related issues:
#457100: "Flag" Files, but not with flag.module
#457094: Help with flag module integration
#457076: theme_imagecache_formatter not a registered theme function
Comment #8
scroogie commentedAh, I see the problem. But if you think about it, if you want to mark the image only in the current node, you actually don't want to flag _the file_. You want to flag a value of a field instance, and thus should probably use a different base table. Perhaps the content_field_{yourfieldname} table? The problem is that it doesn't have a primary key. Doesn't Flag provide an API for that? (like accepting arrays for content_ids?).
Comment #9
quicksketchI'm closing this issue since the ability to flag files will not be added to flag core.