[Solved] Where is information about the album highlight stored?
brunson
Joined: 2005-12-27
Posts: 8
Posted: Thu, 2010-09-09 17:21
I've been poring over the schema and can't seem to find where the the reference to highlight is tracked for each album. Can someone point me to the table where it's stored?
I'm not sure where in the DB that's stored either, but you might want to start digging around in modules/core/ItemMakeHighlight.inc and follow that trail.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
All of my g_onLoadHandlers in g2_Entity are set to Null. I'm reading through the code right now.
nivekiam
Joined: 2002-12-10
Posts: 16504
Posted: Thu, 2010-09-09 21:03
Oops, sorry man, I should really refresh the page before posting. I opened the topic, and left to get lunch and got pulled aside for other things...
Ignore my comment, suprsidr knows what he's talkin' about here.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
brunson
Joined: 2005-12-27
Posts: 8
Posted: Thu, 2010-09-09 22:13
It looks like for every g2_Entity with g_entityType = 'GalleryAlbumItem' there may be, at most, one g_Entity of type 'GalleryDerivativeImage' related to the GalleryAlbumItem through the cross-reference table g2_ChildEntity. If that child entity exists, then it is the highlight for the album.
Most of the schema was pretty easy to understand, that convention had me searching for the better part of two days. I ended up doing text searches through a mysqldump of my gallery2 database. :-P
I'm completing my project with the above assumption. If it turns out to not be the case, then I'll post back.
suprsidr
Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2010-09-09 22:22
Not sure what your "project" is, but G2 API is pretty simple(for me anyways), so if you need help or examples...
I'm pulling this data out of the database in python, so the API isn't useful to me. Also, my conclusion above is wrong, I still don't know where the thumbnail id is stored.
suprsidr
Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2010-09-09 22:38
the thumbnail is simply a derivativeImage g2_ThumbnailImage
Here's what I need: Given an album id, derive enough information from the database to construct the link to the thumbnail for the highlight of that album.
suprsidr
Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2010-09-09 23:18
Load the album's children and derivatives, and look for the derivative w/ the highlight onLoadHandlers
I eventually plowed through it, here's the SQL I came up with:
select prjitm.g_Title as prjtitle,
prjitm.g_id as prjid,
prjitm.g_summary as prjsum,
thmimg.g_derivativeSourceId as thmid,
thment.g_serialNumber as thmser,
thmfsent.g_pathComponent as fname
from g2_Item as prjitm
join g2_ChildEntity as prjent on prjent.g_id = prjitm.g_id
join g2_AlbumItem as prjalb on prjalb.g_id = prjitm.g_id
join g2_ItemAttributesMap as prjattr on prjattr.g_itemId = prjitm.g_id
join g2_ChildEntity as topent on topent.g_id = prjent.g_parentid
join g2_Item as topitm on topitm.g_id = topent.g_id
join g2_AlbumItem as topalb on topalb.g_id = topitm.g_id
join g2_ChildEntity as mikent on mikent.g_id = topent.g_parentid
join g2_Item as mikitm on mikitm.g_id = mikent.g_id
join g2_ChildEntity as prjchld
on prjchld.g_parentId = prjitm.g_id
join g2_Entity as thment
on thment.g_id = prjchld.g_id
and thment.g_entityType = 'GalleryDerivativeImage'
join g2_Derivative as thmimg on thmimg.g_id = thment.g_id
join g2_ChildEntity as fsent on fsent.g_id = thmimg.g_derivativeSourceId
join g2_FileSystemEntity as thmfsent on thmfsent.g_id = fsent.g_parentId
where topitm.g_title = 'Website Projects'
order by prjattr.g_orderWeight
most of it is getting to the album I want to find sub albums in, the meat of getting to the thumbnail is here:
join g2_ChildEntity as prjchld
on prjchld.g_parentId = prjitm.g_id
join g2_Entity as thment
on thment.g_id = prjchld.g_id
and thment.g_entityType = 'GalleryDerivativeImage'
join g2_Derivative as thmimg on thmimg.g_id = thment.g_id
join g2_ChildEntity as fsent on fsent.g_id = thmimg.g_derivativeSourceId
join g2_FileSystemEntity as thmfsent on thmfsent.g_id = fsent.g_parentId
You have to find a child entity of the album of type 'GalleryDerivativeImage', then find that derivative and the derivative's child entity so you can get to filesystem entity for the pathcomponent. Given all that you have the derivative id, serial number and filename, so I can create the URL for the highlight.
Thanks for your time, I appreciate your help. In the end it was just a bit convoluted, but mainly it was knowing the convention of finding the derivative image entity in child entity.
suprsidr
Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2010-09-10 00:11
So can't python query an online data manager(galleryData.php) for this info in a qualified format like json or mediaRssXML?
I have the scripts already written... no need to re-invent the wheel.
Actually, that was a solution I hadn't considered. When you said "API" I thought of the PHP libraries that I was wading through, I'd forgotten that gallery exposes an interface over http.
Posts: 8339
g2_Entity|g_onLoadHandlers
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 16504
I'm not sure where in the DB that's stored either, but you might want to start digging around in modules/core/ItemMakeHighlight.inc and follow that trail.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 8339
I thought I answered that one?
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 8
All of my g_onLoadHandlers in g2_Entity are set to Null. I'm reading through the code right now.
Posts: 16504
Oops, sorry man, I should really refresh the page before posting. I opened the topic, and left to get lunch and got pulled aside for other things...
Ignore my comment, suprsidr knows what he's talkin' about here.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 8
It looks like for every g2_Entity with g_entityType = 'GalleryAlbumItem' there may be, at most, one g_Entity of type 'GalleryDerivativeImage' related to the GalleryAlbumItem through the cross-reference table g2_ChildEntity. If that child entity exists, then it is the highlight for the album.
Most of the schema was pretty easy to understand, that convention had me searching for the better part of two days. I ended up doing text searches through a mysqldump of my gallery2 database. :-P
I'm completing my project with the above assumption. If it turns out to not be the case, then I'll post back.
Posts: 8339
Not sure what your "project" is, but G2 API is pretty simple(for me anyways), so if you need help or examples...
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 8
I'm pulling this data out of the database in python, so the API isn't useful to me. Also, my conclusion above is wrong, I still don't know where the thumbnail id is stored.
Posts: 8339
the thumbnail is simply a derivativeImage g2_ThumbnailImage
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 8
Sorry, I meant the highlight reference.
Here's what I need: Given an album id, derive enough information from the database to construct the link to the thumbnail for the highlight of that album.
Posts: 8339
Load the album's children and derivatives, and look for the derivative w/ the highlight onLoadHandlers
I may be able to write the SQL if you need.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 8
I eventually plowed through it, here's the SQL I came up with:
most of it is getting to the album I want to find sub albums in, the meat of getting to the thumbnail is here:
You have to find a child entity of the album of type 'GalleryDerivativeImage', then find that derivative and the derivative's child entity so you can get to filesystem entity for the pathcomponent. Given all that you have the derivative id, serial number and filename, so I can create the URL for the highlight.
Thanks for your time, I appreciate your help. In the end it was just a bit convoluted, but mainly it was knowing the convention of finding the derivative image entity in child entity.
Posts: 8339
So can't python query an online data manager(galleryData.php) for this info in a qualified format like json or mediaRssXML?
I have the scripts already written... no need to re-invent the wheel.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 8
Actually, that was a solution I hadn't considered. When you said "API" I thought of the PHP libraries that I was wading through, I'd forgotten that gallery exposes an interface over http.
I'd love to see the scripts.
Posts: 8339
Well, one of the native would be gallery's slideshow mediaRss
http://www.flashyourweb.com/media/index.php?g2_view=slideshow.SlideshowMediaRss&g2_itemId=32&g2_browserPlugin=1&g2_offset=0
I also have my own which does all of the above plus dynamic albums including keyword, tag, rating...:
http://www.flashyourweb.com/gallery2/mediaRss.php?mode=dynamic&g2_view=rating.RatingAlbum
also mediaBlock.php for displaying images on external pages:
http://www.flashyourweb.com/staticpages/index.php?page=mediaBlock
jQuery version w/ cross-site json:
http://www.flashyourweb.com/staticpages/index.php?page=jQuery_mediaBlock
minislideshow utilizes mediaRss.php as does E2:
http://www.flashyourweb.com/staticpages/index.php?page=TheMiniSlideShow
http://www.flashyourweb.com/staticpages/index.php?page=TheExecutive
SlideshowPro:
http://www.flashyourweb.com/filemgmt/index.php?id=41
http://www.flashyourweb.com/filemgmt/index.php?id=15
Cooliris:
http://www.flashyourweb.com/article.php?story=CanHTML5dothis
Its very easy to get gallery to output to your needs/liking.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2