Linker module discussion - (same image in multiple albums) - work started!

jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2013-04-15 17:03

I've finally come up with a need to have the same pic in multiple albums. (But linking to one image file vs. having multiple copies of the same image)

I wanted to open a discussion here on potentially doing up a module for this.

Anyone played with this idea at all?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2013-04-15 17:32

Tags does this already

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2013-04-15 17:36

It does in a way, being that you can have dynamic albums with pointers to images within other albums, but unless I'm mistaken, or just plain ignorant on it, it's not quite what I'm thinking?

Take this as an example:

I have an album called 'Videos'
I have an album called 'Arizona Vacation Apr 2013'

Generally I send my videos to the Videos album of course
However, now I'd like to have a video in the Videos album also appear in the Arizona Vacation album
But, I don't want to have two copies of the video on the disk

This might not be the best description, as I'm sure that the response could be, virtualize (dynamic) the videos album, and tag all videos with 'video', but there are a number of other requirements that might not fit this solution.

I think?

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2013-04-15 17:51

Notes for future reference:

DB Items:
id
parent_id
relative_path_cache
relative_url_cache

Dir Items:
links in album/resize/thumb

Other concerns:
what effect of deletion? (Would you want to delete both? Just the linked one, or the original? How to detect?)
what effect of modification (rotating?) (Rotating would break the db entries for height/width unless done on both, which wouldn't be trivial to detect that it's a linked image... PROBLEM 1)

Process:
duplicate db record - modifying above db items
create the symlinks in each directory above
?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2013-04-15 17:54

I think all albums should be virtual so your Video album would be all items tagged 'video' and as well all items tagged 'Arizona Vacation Apr 2013' would show in that virtual album including the video
any item could belong to many albums easily. I did something similar when I built my node app(other iterations of this app have more photos)

There would be no need for a directory/sub-directory structure in var as all items could be stored in the same place.

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2013-04-15 18:02

I agree with that thought process, but G3 isn't inherently structured that way. I have a need to have them sorted as the gallery does for other purposes, and integrating the tagging in to that would be a large stretch of work.

While tagging certainly negates the need to physically sort/duplicate them, having them physically sorted provides some benefit, administratively.

Hoping that we keep this purely conversational to see what our options are.

Thanks for the input!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2013-04-15 20:01

There is the http://codex.galleryproject.org/Gallery3:Modules:item_links that would be similar.
I think a better solution would be like in G2. It created a new tab on the add item dialog.
On that tab it had a album/item tree similar to the http://codex.galleryproject.org/Gallery3:Modules:albumtree . I guess you could reuse the code from the albumtree mocule or use the code from the organize module (it has a tree as well).
You selected an item from the tree and it added that item to the album you were in.

I'm not sure how it worked in the back-end.

I think if the original item changes then the other linked items should change as well, like rotation, tags, description, title etc. Then in the same vane if the original get deleted the link does as well (perhaps some warning on items that are the originals for tasks would be nice to have).

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2013-04-15 21:31

@dave: Exactly along the same lines I was thinking as well for the backend.

Only things of concern are how to handle 'both' images in the database, and how to warn of deletes and handle those on 'both' as well... (hooking in to the core code events for each instance)

'both' = linked images, could be more than two instances.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Wed, 2013-05-01 20:08

Started to code this out :) What fun.

Anyway, more thoughts to note: (thinking out loud, and may not be clear)

* Deletion - prompt user, if deleting a link(ed) item, whether to delete either this one (the one from which they clicked delete) or both items -> if deleting original, take away 'linked' attribute in db (separate table) but DON'T delete file, just delete item table entry (for orig) - (this could be difficult for when an item is linked to more than once)

* Rotation - will rotate both (sort of) -> for the linked item, only modify the width and height details in item table (can't selectively rotate links because, unlike delete, there is no 'pre rotate' event to draw from)

* Linking from a link (bad) - Need to take this in to account - check if item is a link, then advise user to link from orig - maybe redirect to that?

* multiple (more than one link to same item) -> use separate table (see deletion above) to keep track of what is linked to what - used for deletion and rotation needs (so where I said above, 'both', may be 'more than one' or 'all linked items')

* Now I know why no one has tackled this...

* I'm beginning to like suprsidr's idea...

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Wed, 2013-05-01 21:44

* Things not considered yet:
* Tags, descriptions, titles... might be -easier- to leave these as is - there is no reason to 'update' both when changed, at least I don't think so.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Thu, 2013-05-02 18:55
 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2013-05-02 18:59

So how about this... Utilize the already existing tags module, only add the ability to add tags to normal albums so these tagged images will also show in any album that the tag has been added to.
This would be much simpler.

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Thu, 2013-05-02 19:21
suprsidr wrote:
So how about this... Utilize the already existing tags module, only add the ability to add tags to normal albums so these tagged images will also show in any album that the tag has been added to.
This would be much simpler.

-s
________________________________
All New jQuery Minislideshow for G2/G3

That does sound like a good method. I wonder if the 'album viewing' has enough flexibility for that.

The more I'm thinking, the more I like the 'virtual album' ideas.

Meh, who knows, I have a specific purpose which is limited to being able to duplicate an image/movie in to another album, so I went this route.

Your idea seems like it would be the most flexible and feature-rich idea...

I'm probably too lazy to go through and tag ~35k images...

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2013-05-02 19:26

Way better than trying to map which items belong to which albums.

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Thu, 2013-05-02 19:49

Shoot, now I like your idea much better... but the effort of tagging photos seems painful as we've never done it, and have ~35k to do.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2013-05-02 19:53

not all photos need to get tagged unless one wants that kind of fine grained control. Some will simply belong to the album they are in. BUT this would make it much easier to make any item belong to any album(s)

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2013-05-02 19:55

This may also be a way to have sub albums based on tags as well
Like windows libraries contain other locations:
"This album also contains this related album..."

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Thu, 2013-05-02 22:11

The tags module a core module to G3 right?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2013-05-02 22:21

Looks like rWatcher created it and others extended it.
http://codex.galleryproject.org/Gallery3:Modules:tag_albums

I think there is room for expansion. rWatcher may even want to pitch in.
Build a feature list -> roadmap

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2013-05-02 22:23

I take that back, looks like tags are baked-in the other modules are just ways of extending/displaying tags

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sat, 2013-05-04 22:27

Okay, I've decided to scratch this whole idea.

As much as I've worked on it, I've realized several issues with trying to deal with linking...

There is simply too much to account for in the flexibility of Gallery...

Moving item - this is really difficult to track
Rotating item - somewhat simple, but results in actions happening at the wrong time and inability to track
Renaming item - Don't think this matters.
Deleting item - easy enough, and done...

It's just entirely too much to manage and keep track of, and in trying just creates more of the events in a horrible loop.

Sorry, I give up :) (maybe)

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2013-06-10 23:40

Rethinking this a bit, and it may be possible with some minor inconveniences. Minor being removing the ability to modify or delete the original. This minor part -can- be handled with a lot of coding, so who knows.

I may revisit this.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Wed, 2013-06-12 00:08

I've got two more functions to write to hopefully have this is some sort of usable, and thus, testable, state... Hopefully soon!

If anyone has interest in helping me test, let me know... must be tested only on a test gallery that you can afford to blow up!

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Wed, 2013-06-12 14:25

Well, I expect further delays now as a realization came to me that the 'organize' module allows changes that I can't easily override. I have an idea for resolution, but this is a major impact.