Which item is the highlight for an album?
marcusbrutus
Joined: 2005-11-17
Posts: 64 |
Posted: Wed, 2005-11-30 06:32 |
Hi all, I've figured out many of the ways that g2 stores data, Would someone be able to enlighten me? Thanks, Marcus. |
|
Posts: 32509
get the albumd id. get the thumbnail for the album (GalleryCoreApi::fetchThumb....) that's the album highlight.
Posts: 64
Thanks for your help valiant,
I browsed through the php you mentioned and found this:
and was able to do something like this:
$ mysql -pPASSWORD -uroot gallery2 -e 'SELECT Site_Derivative.Site_Id, Site_ChildEntity.Site_parentId FROM Site_Derivative, Site_ChildEntity WHERE Site_Derivative.Site_id=Site_ChildEntity.Site_id AND Site_ChildEntity.Site_parentId=353'
(where 353 was the itemID of the album I was interested in)
This does, indeed, return the ID of the thumbnail!
$ mysql -pPASSWORD -uroot gallery2 -e 'SELECT Site_Id, Site_derivativeSourceId FROM Site_Derivative WHERE Site_id=364 '
$ mysql -pPASSWORD -uroot gallery2 -e 'SELECT Site_Id, Site_derivativeSourceId FROM Site_Derivative WHERE Site_id=362 '
Which finally gives me the result I want. (The image itself)
Do I really need to loop queries until I find an ID that exists in the Item table?
or is there a neater way?
Thanks again,
Marcus.
Posts: 32509
generally, you should always use the G2 API and not db queries.
see:
http://gallery.menalto.com/node/40860
Posts: 64
Thanks valiant,
that makes sense, however, I know nothing of php and I wouldn't know
where to start with using API functions from a bash script.
I'll see what I can find out.
The script I've mentioned above uses the same sql select commands all
the way through. I've now succesfully written a test script that
gives the original image from the thumbnail highlight.
It's all VERY crude I'm afraid, but I barely understand what I'm doing ;)
Marcus