Flickr Tags
mlathe
Joined: 2005-10-16
Posts: 15 |
![]() |
I just migrated from a flickr account to a new G2 installation after i realized how sucky the flickr free account is. One thing the G2 needs is the flickr tags, and it sounds like a lot of other people agree. Has anyone started on a new module to accomplish this? If not can anyone with general G2 knowledge offer some design hints? I'm thinking i might take this on. eg. opinions on things like: etc |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
there have been a few discussions in these forums about flickr style tags in G2, e.g. a few notes: g2 development: implementation: |
|
mlathe
Joined: 2005-10-16
Posts: 15 |
![]() |
cool. thanks As for the other links i've read them before, but there seems to be some good info there anyways. So i think i'll probably start this. I'm guessing "customfield module" would be a good starting point... i'll look this up. Here are my current ideas. Lots are stolen from Flickr, b/c they do it very well (quick/simple) that should be a good start. --matthias |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
Quote:
--user enter's tags into text box, separated by spaces, this is inserted into a tags table (as Valiant described)... do it quick/simple!. i'd argue for a database Map table with 2 colums: and you'd have an row in this table for each tag you add / remove to a specific item. why do i mention this? thus, i'd do it with a row per tagId and not a comma separated list of tags in the database. |
|
mlathe
Joined: 2005-10-16
Posts: 15 |
![]() |
Quote:
a Tags table: tagId, tag name, tag description, ..., a Map table: mapping itemId with tagId= This was what you recommended in your first reply. I'd argue that this is overkill. The tags table is not needed only the TagMapping table. I agree with you that the relationship should be one entity to many TagMappings, otherwise getting a list of entities that have a specific tag requires a LIKE in the WHERE clause (slow, and not ideal). Also doing a select count(*) from tagsMapping is really a pain in the butt. I think we are on the same page on this one. one clarification: when i say that the user enters the tags using one text field i mean that the code will tokenize this and insert one row into the TagMappings table for each token. Thus easy to use, easy to add new tags, easy to search, a little bit hard to write the SQL... Hence easy for the user. Anything more? |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
why i also mentioned the Tags table: |
|
mlathe
Joined: 2005-10-16
Posts: 15 |
![]() |
yeah i see your point... i'll mark that as an enhancement. Right now i just want to get something simple working... |
|
mlathe
Joined: 2005-10-16
Posts: 15 |
![]() |
i have a few dev questions: This is the start of a module.inc i'm writing. it doesn't seem to do anything though. Its based off of the shutterfly module. Module.inc is the handle for installing the module right? i'm guessing that i need to register all the events that my module needs in this class (via performFactoryRegistrations?). These registrations will map an event (like painting the header) to a controller .class file. That controller will run, and somewhere specify a template to render the controller's view. I'm making a guess here. I'm i on the right path? /** * @package Tags */ class TagsModule extends GalleryModule { function TagsModule() { global $gallery; $this->setId('tags'); $this->setName($gallery->i18n('Tags')); $this->setDescription($gallery->i18n('Tag Gallery items with Flickr type tags')); $this->setVersion('1.0.0'); $this->setGroup('gallery', $this->translate('Gallery')); $this->setCallbacks('getItemLinks'); $this->setRequiredCoreApi(array(6, 0)); $this->setRequiredModuleApi(array(2, 0)); } /** * @see GalleryModule::isRecommendedDuringInstall */ function isRecommendedDuringInstall() { return false; } /** * @see GalleryModule::autoConfigure */ function autoConfigure() { /* We don't require any special configuration */ return array(GalleryStatus::success(), true); } /** * @see GalleryModule::getItemLinks() */ function getItemLinks($items, $wantsDetailedLinks, $permissions) { $links = array(); foreach ($items as $item) { echo "hello world"; $itemId = $item->getId(); if (isset($wantsDetailedLinks[$itemId])) { if (GalleryUtilities::isA($item, 'GalleryPhotoItem')) { $params['view'] = 'tags.AddTag'; $params['itemId'] = $itemId; $params['return'] = 1; $links[$item->getId()][] = array('text' => $this->translate('Add Tag to this image'), 'params' => $params); } } } return array(GalleryStatus::success(), $links); } } |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
@inc: Quote:
Module.inc is the handle for installing the module right? right, but it's also used for more. module.inc tells G2 a lot of things about your module. Quote:
i'm guessing that i need to register all the events that my module needs in this class (via performFactoryRegistrations?). These registrations will map an event (like painting the header) to a controller .class file. That controller will run, and somewhere specify a template to render the controller's view. I'm making a guess here. I'm i on the right path? yes and no. @performFactoryRegistrations: @getItemLinks: see my explanations about views / controllers in the link i mentioned in the second post of this topic. maybe you want to add your tags list on the edit photo -> general page or in a separate tab. then you should look at itemEditOptions and ItemEditPlugins. grep the existing modules for such occurrences. |
|
mlathe
Joined: 2005-10-16
Posts: 15 |
![]() |
cool i'll take a look into this stuff in a bit. Can we make a "how to make a module" codex page? i tried, but i can't seem to figure out how to make a new page... i can only edit. Do i need a perm? (my user name is mlathe at the codex). |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
creating a new codex page = just enter a new address in the browser. btw: on http://gallery.menalto.com/dev |
|
mlathe
Joined: 2005-10-16
Posts: 15 |
![]() |
Quote:
btw: on http://gallery.menalto.com/dev Dude... this is EXACTLY what i was looking for (wanting to make). I will now start from here. |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
well, the tutorial is very incomplete and only touches very few aspects of module making. feel free to extend it ;) |
|
mlathe
Joined: 2005-10-16
Posts: 15 |
![]() |
so i finally got around to getting started. Had to install Linux and all the little packages that come with it. I must say some of these distros are getting pretty easy to manage. In any case. I checked out that tutorial. It helped, but its really out of date, and doesn't seem to work right out of the box. Had to edit some things. I've got the beginning of this module working, now i need to get the SQL to work. I found the following link. I think that's enough for now :D |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
Quote:
--am i right that all i need to do is make a file like /modules/tag/class/Tag.class? copy the GNUmakefile from another module, and make it? is that it? yes. you need to change the xml instructions in the Tag.class too though. Quote:
--I'm a bit confused about the difference between a Map and an Entity. I understand what they are/mean, but which one should i use in this case? use maps when you map something together. but when you're tagging, you're mapping a tag with an item. Quote:
--How are the tables made? (i think gmake makes the CREATE stmts, but when/how is this run). the SQL CREATE TABLE stuff is generated with gmake. |
|
mlathe
Joined: 2005-10-16
Posts: 15 |
![]() |
Ok i'll try to get the gmake to work... ie get the prereqs as described in the link in my previous post. I see that g2 almost forces an almost "star" schema on data. That is, there are data tables but these have no foreign keys, and there are map tables, that don't have any data, but only foreign keys. So i guess i will implement this as you recommended in one of the first posts (make two tables....) Can you point to some documentation or explain about what the following means? Quote:
* @g2 <class-name>GalleryItem</class-name> Thanks, I'll try to get this written up into the codex tomorrow for everyone's enjoyment. |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
- yes, the @g2 comment lines are parsed by lib/tools/bin/extractClassXml.pl (therefore our current perl requirement when generating interface and sql files). this is valid XML, the corresponding dtd is in lib/tools/dtd/ . the resulting xml is validated and then used to generate the interfaces (which add setter and getter methods for object/entity classes and add, update, remove map entry methods for map classes), and it generates the create table SQL for all database management systems (currently DB2, mysql, oracle, postgresql). Quote:
hanks, I'll try to get this written up into the codex tomorrow for everyone's enjoyment. that would be great! |
|
mlathe
Joined: 2005-10-16
Posts: 15 |
![]() |
thanks for the info I have some of the DB stuff working... but i'm stuck on the actual INSERT. This is some code from the comments module. I read this as getting a handle to the interface in tag/classes/interface. However it always returns with ERROR_MISSING_OBJECT. Can you tell me a little more about the newFactoryInstance method? and maybe how to debug this some more? thanks list ($ret, $tag) = GalleryCoreApi::newFactoryInstance('GalleryEntity', 'GalleryTag'); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } if (!isset($tag)) { return array(GalleryStatus::error(ERROR_MISSING_OBJECT, __FILE__, __LINE__), null); } |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
to clarify: if you use see modules/comment/classes/GalleryComment.class so you want and finally you need to register your entity: function performFactoryRegistrations() { $ret = GalleryCoreApi::registerFactoryImplementation( 'GalleryEntity', 'GalleryTag', 'GalleryTag', 'modules/tag/classes/GalleryTag.class', 'tag', null); if ($ret->isError()) { return $ret->wrap(__FILE__, __LINE__); } return GalleryStatus::success(); } |
|
mlathe
Joined: 2005-10-16
Posts: 15 |
![]() |
How do you do a debug stmt... echo "foo"; thows an error, "headers already sent by". valiant, thanks for all your help. Seems like despite the large number of people who voted for this module, there isn't much interest in it. |
|
mlathe
Joined: 2005-10-16
Posts: 15 |
![]() |
am i right to assume that if you extend a GalleryChildEntity G2 handles the entry into the ChildEntity table, and thus when you delete the Entity a trigger is fired that helps clean up the extended class? e.g. a Comment is added to a picture, if you delete the picture do all the comments get dumped too? seems like this is what we want here. a Tag is like a specialized comment, that is marked across several entities. |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
yes, if you declare and register an entity as entity type X (e.g. DerivativeImage), then G2 inserts automatically db rows in all necessary tables when creating / saving and it deletes them again when you call $entity->delete(); and yes, you're right, i guess it makes sense to extend the childentity...it's a lot like comments. and no, we're not yet deleting all comments when you delete an item or a user (the owner of the comment), but that's a bug. you can assume we're taking care of that such that when an item get's deleted, all child entities related to it get deleted too. |
|
mlathe
Joined: 2005-10-16
Posts: 15 |
![]() |
Well i have it about 70% done. However one thing that is a real pain in the butt is that you have to edit the tags for each entity by itself. This is not ideal. I've read that G2 has a problem in that batch changes can't be done (at least not now). Have you seen/know of any way to do a batch edit? ideas? |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
well, you could do something like the modules/core/ItemEditCaptions.inc for tags as a temporary solution. |
|
mindless
![]()
Joined: 2004-01-04
Posts: 8601 |
![]() |
are you using a separate table rather than the existing keywords so each tag is in its own row in the table? (ie don't need to use LIKE in queries) will lots of people say "hey, I already keyworded all my items, I can't use them??" |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
well, keywords and tags serve a slightly different purpose. some users might want to use both of them at the same time, differently. |
|
mindless
![]()
Joined: 2004-01-04
Posts: 8601 |
![]() |
i don't have too much time/interest in this feature, but it does get a lot of votes so here I will post a bit of code I hacked together... we'll see if it provides any ideas or leads anywhere. the attached file include a module and small patch to modules/core/classes/GalleryTheme.class what does work:
caveats and what doesn't work:
perhaps this will give bharat or others some ideas about how the framework can be adjusted to better handle non-album containers. |
|
mindless
![]()
Joined: 2004-01-04
Posts: 8601 |
![]() |
has interest in this feature declined? should i reset all the votes? hehe |
|
FuriousBroccoli
Joined: 2005-11-18
Posts: 1 |
![]() |
Interest hasn't declined here, I'd love to hear any updates... |
|
toastmaster
Joined: 2003-05-01
Posts: 219 |
![]() |
Definitely not here either - it's still number 2 most requested, only just behind bulk watermarking. I'd love to see this feature as well. |
|
dbchip2000
Joined: 2005-12-11
Posts: 4 |
![]() |
Here's what I have done, I am a complete beginner at Gallery2, but I think this tag module is better than what's currently available (umm, nothing, that I know of). I certainly don't consider it production quality by any means, but here's the info on it if anyone else wants to use it for now or pick up where I've left off - haven't tried it with rewrite module Anyway, I like how it works for my own use and I hope someone else comes out with a better one I can use...but here's for all the other people like me. I'm just too preoccupied to continue experimenting with it and certainly want to know when an official tag module comes out |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
just....wow! this is great! so you went with a tag entity instead of a itemId <-> tag map table. maybe we'll have to change that but the rest looks awesome. maybe we can then use mindless' idea of keyword / tag albums somehow. i'll test the module tomorrow. |
|
Jeremy Butler
Joined: 2005-12-07
Posts: 33 |
![]() |
dbchip2000 wrote:
Anyway, I like how it works for my own use and I hope someone else comes out with a better one I can use...but here's for all the other people like me. Excellent. Thanks for sharing! I've installed it on my test site and it seems to work fine. A couple of comments. * After installing, be sure to add the tags to your themes. Otherwise, you won't see them. (I'm new to Gallery2 and missed this initially.) Regards and thanks! Jeremy |
|
Jeremy Butler
Joined: 2005-12-07
Posts: 33 |
![]() |
Here's a possible bug in modules-tag: Adding tags to images in the top-level of Gallery worked, but when I tried to add some to images in an individual album, they did not display. The tags appear to have been attached to the images because the thumbnail of the image accurately displays something like: DayForNight02_jpg However, when you go to the full-sized image, tags are not listed. Regards, P.S. I tested this while logged in as administrator so I don't think it's a permissions issue. P.P.S. The first image I tried this on had a comment already attached, but I don't think that's the problem. When I tried another image without a comment, it also did not display the tags. Jeremy Butler |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
- when developing php applications, set error_reporting to E_ALL in php.ini - i had to copy GNUmakefile's from the current comment module to make it work with the current nightly snapshots (the database schema has changed) - getting: "Notice: Undefined variable: totalTags in /var/www/localhost/htdocs/clean/gallery2/modules/tag/Callbacks.inc on line 86" - postgres compatibility issue: the problem is this code $query = sprintf(' SELECT [GalleryChildEntity::id], [GalleryTag::tagName], "", "", [GalleryChildEntity::parentId] in GalleryTagSearch.class, which doesn't make a lot of sense - when deleting a tag, i get "Notice: Undefined index: tag in /var/www/localhost/htdocs/clean/gallery2/g2data/smarty/templates_c/%%672277621/%%38^385^385FFEDD%%Tag.tpl.php on line 4" in the delete tag view - rewrite rules: i tested the module with url rewrite active, but the rewrite rules were not used. @Jeremy Butler: |
|
Jeremy Butler
Joined: 2005-12-07
Posts: 33 |
![]() |
valiant wrote:
- @permissions, go to your top album, click "edit permissions", add the tag permissions to the everybody group Hmmmm... I'm new to Gallery so I may have done this wrong, but I went to "New Group Permission" and added the tag permissions to Everybody. Permissions now look like: Group name Permission Action But the tags are still not displayed. What have I missed? Thanks! |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
what did you miss? |
|
Jeremy Butler
Joined: 2005-12-07
Posts: 33 |
![]() |
Still mystified about the lack of tags. And, something new, when I'm looking at the Album permissions page (trying to figure out how I've messed up the permissions), and I click "View Tags" in the sidebar, I get: Error Detail - * in modules/core/classes/GalleryView.class at line 158 (gallerystatus::error) Jeremy Butler |
|
Jeremy Butler
Joined: 2005-12-07
Posts: 33 |
![]() |
Hey, it started working! That is, the tags started showing up in the photo pages within an album. I don't know if this is what did the trick, but I shifted from one theme to another and then back to the original (Matrix). After going through that process, the tags began showing up! Jeremy Butler |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
dbchip2000 i hope i didn't scare you off with my mini review |
|
He11Fire
Joined: 2005-12-19
Posts: 5 |
![]() |
this is kinda great |
|
easterlingman
Joined: 2006-01-11
Posts: 7 |
![]() |
yes.. this is an essential feature for me - I'm waiting till it's finished (or until I can find other open source gallery software that supports it) to install g2 |
|
FriedBunny
Joined: 2005-09-21
Posts: 2 |
![]() |
Sorry to bump a relatively old thread, but I was curious as to where this has gone, if anywhere? |
|
mindless
![]()
Joined: 2004-01-04
Posts: 8601 |
![]() |
this thread is the only thing i've seen about work on this feature.. so, not much progress. |
|
toastmaster
Joined: 2003-05-01
Posts: 219 |
![]() |
Fingers crossed, though. It's the most requested item in the feature vote (1204624 - not counting bulk watermarking as that is done and closed now). Probably the most requested on the forums, too. |
|
Eka_Mei
Joined: 2006-01-03
Posts: 132 |
![]() |
Have this gotten any development lately at all? |
|
easterlingman
Joined: 2006-01-11
Posts: 7 |
![]() |
this sourceforge message has some info on the project: http://sourceforge.net/mailarchive/message.php?msg_id=12601674 |
|
youpi
Joined: 2005-06-17
Posts: 35 |
![]() |
can you update your module tag please ? |
|
Eka_Mei
Joined: 2006-01-03
Posts: 132 |
![]() |
I have downloaded this module and test it with a 2.0 version. I ahve to say it really does do exactly what Tag are suppose to. Perhaps just a few more improvement and it will be exactly like how Flickr's tag work. Can anyone try make this compatiable with 2.1? Thanks! |
|
dbchip2000
Joined: 2005-12-11
Posts: 4 |
![]() |
I've started work on a better Tags module that will replace the old one I attached a long time ago. Hopefully soon... |
|
Eka_Mei
Joined: 2006-01-03
Posts: 132 |
![]() |
I can only say I will eagerly await. My skill in coding is still too low to try modifies complex module like this. Thank you for your work so far! I love it! |
|