Which item is the highlight for an album?
marcusbrutus
Joined: 2005-11-17
Posts: 64 |
![]() |
Hi all, I've figured out many of the ways that g2 stores data, Would someone be able to enlighten me? Thanks, Marcus. |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
get the albumd id. get the thumbnail for the album (GalleryCoreApi::fetchThumb....) that's the album highlight. |
|
marcusbrutus
Joined: 2005-11-17
Posts: 64 |
![]() |
Thanks for your help valiant, SELECT [GalleryDerivative::id], [GalleryChildEntity::parentId] FROM [GalleryDerivative], [GalleryChildEntity] WHERE [GalleryDerivative::id] = [GalleryChildEntity::id] AND [GalleryChildEntity::parentId] IN (' . $idMarkers . ') 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' This does, indeed, return the ID of the thumbnail! +---------+---------------+ | Site_Id | Site_parentId | +---------+---------------+ | 364 | 353 | +---------+---------------+ $ mysql -pPASSWORD -uroot gallery2 -e 'SELECT Site_Id, Site_derivativeSourceId FROM Site_Derivative WHERE Site_id=364 ' +---------+-------------------------+ | Site_Id | Site_derivativeSourceId | +---------+-------------------------+ | 364 | 362 | +---------+-------------------------+ $ mysql -pPASSWORD -uroot gallery2 -e 'SELECT Site_Id, Site_derivativeSourceId FROM Site_Derivative WHERE Site_id=362 ' +---------+-------------------------+ | Site_Id | Site_derivativeSourceId | +---------+-------------------------+ | 362 | 361 | +---------+-------------------------+ 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? Thanks again, Marcus. |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
generally, you should always use the G2 API and not db queries. |
|
marcusbrutus
Joined: 2005-11-17
Posts: 64 |
![]() |
Thanks valiant, that makes sense, however, I know nothing of php and I wouldn't know The script I've mentioned above uses the same sql select commands all Marcus |
|