G2 DB structure question

brianlees

Joined: 2002-08-17
Posts: 51
Posted: Sun, 2005-01-09 15:05

I have seen several threads here about integrating G2 into other apps....including one of my own..specifcally about Mambo.

My question concerning G2 is how does the database reference the image? Is there a UID assigned to each image and the DB tracks the physical location (directory) of the image? Or, is the directory structure "married" so closely that it is similar to G1?

Reason I ask is that if G2 is integrated into a CMS package and you can build the integration so it only references the UID, then it doesn't matter where the image is located or if it is ever moved, since the DB query of the UID will say where the image is located...which means missing images on pages will be reduced significantly.

Did any of this make sense?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-01-09 15:19

each item (image, ...) in G2 got a unique itemId. In your G2 config, you specify a g2data directory. All G2 items are stored within this directory (within subdirectories of g2data). All metadata (what itemIds exist, in which album is itemId x, ..) is stored in the database.
There's no filesystem <-> itemId mapping for each itemId. The filesystem path for an item is a function of (itemId, g2data-dir-location).

In a integrated G2, you'll never query the G2 database directly, you'll use the G2 API if you really need it. But normally, you'll only use 1 small part of the G2 API, the GalleryEmbed class which is in embed.php.

I don't exactly know what you have in mind or why you need to know this.
Do you want to use the powerful G2 API as a image manipulation/presentation API in mambo or do you want to integrate G2 into mambo similar to the postnuke, xaraya, ... integrations?
I'd be glad to explain the steps for a mambo integration, if you have this in mind.

 
brianlees

Joined: 2002-08-17
Posts: 51
Posted: Wed, 2005-01-12 02:55

Well, I'm not sure where Mambo integration is going in G2...especially since it is still a work in progress. Here are the things I was thinking about when it came to ingrating with Mambo...or any CMS for that matter:

- be able to embed Gallery images inline with content

- allow for the location of the images to change without having the change the embedded reference. For example, lets say I decide to move the images directory, I don't want to have to go back and redo all the image links....use the DB to find the image. This is something similar that I do on my company's website (coded in Cold Fusion...I unfortunately do not know PHP)

- resize the image to a set size within the content (maybe a preference setting) using an image tool

- link to a larger version of the image, either within Gallery or as a pop-up

Does this make any sense?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-01-12 07:52

brianlees, what you're talking about are all advances uses of G2. You're talking about G2 as a image backend to your articles, ... in mambo.
G2 is mainly an online album, organize your photos, show them to your friends,...

What I did in my xaraya integration:
- embedded G2 visually and integrated the user/group management
- now there is a feature request by a xaraya user that wants the same things as you wish for mambo

-> This is certainly possible. I'll do it soon, it's on my todo list, but for the xaraya integration.

To your specific requests:
- be able to embed Gallery images inline with content
-> should be possible

- allow for the location of the images to change without having the change the embedded reference.
-> As long as G2 knows about the change of the physical location of the images, this works. By that I mean that if you change the whole g2data dir, you have to change the appropriate config value in the config.php file. If you just wanna move one album or image to another album, this works anyway.

- resize the image to a set size within the content (maybe a preference setting) using an image tool
-> If you set the G2 thumbnail size to the prefered size that you wish in mambo, this should work. If you wish different thumbnail sizes, there are some things to change.

- link to a larger version of the image, either within Gallery or as a pop-up
-> to G2, no problem. as a pop-up, afaik not possible.

Still, you need someone who knows coding in mambo to start this mambo / G2 integration.

 
brianlees

Joined: 2002-08-17
Posts: 51
Posted: Wed, 2005-01-12 22:56

Thanks for the info. TO be clear, I still want to use Gallery as an online album, like I am now (v1). However, I would like to enter new content and reference images in the gallery. For example, a story about a vacation. I could link a few images that lead the users to the album.

Basically, taking Gallery, already one of the best online image albums, and making it better by allowing it to closely integrate with other CMS packages. I assume that G2 was designed with integration in mind, allowing it to be a straightforward process for someone who knows what they are doing.