How does Gallery locate an image in on disc?

richardb

Joined: 2006-01-26
Posts: 33
Posted: Sat, 2010-10-16 09:51

I have several installations of Gallery2 - this is the largest:

http://www.eggsa.org/library/main.php

but this is not a problem but a request for information. If someone could tell me or point to this information I would be grateful.

How does Gallery2 make up (find out) the path to its various items?

I have looked through all the database tables. I can find the item and I can find, in fileSystemEntity, the disk name of the file but I cannot see how Gallery records or makes up the path to the file name.

So if an item is stored in

G2-albums/picture-files/books/thisbook.jpg

how does it locate it with only the filename thisbook.jpg in the database?

I must be missing something?

I have no experience programming for Gallery but have several times had to repair the database 'by hand' so am somewhat familiar with parts of that.

Thanks for any help you can offer.

Richard

 
richardb

Joined: 2006-01-26
Posts: 33
Posted: Sat, 2010-10-16 10:16

Never mind, thanks, I have now worked it out.

Uses ChildEntity table with FileSystemEntity table to create the path.

Thanks,

Richard

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2010-10-16 15:06
list($ret, $item) = GalleryCoreApi::loadEntitiesById($g2_itemId, 'GalleryItem');
if ($ret) {
    return "Error loading item:".$ret->getAsHtml();
}
list($ret, $path) = $item->fetchPath();
if ($ret) {
    return "Error fetching path for item:".$ret->getAsHtml();
}

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
richardb

Joined: 2006-01-26
Posts: 33
Posted: Tue, 2010-10-19 18:00

Thanks for the functions, suprsidr.

Richard