Step one: copy the logic in module.attach_to_post.php's substitue_placeholder_imgs($content) method:
```
if (preg_match_all("#<img.*http(s)?://(.*)?".NGG_ATTACH_TO_POST_SLUG."(=|/)preview(/|&|&)id(=|--)(\\d+).*?>#mi", $content, $matches, PREG_SET_ORDER))
{
$mapper = C_Displayed_Gallery_Mapper::get_instance();
foreach ($matches as $match) {
// Find the displayed gallery
$displayed_gallery_id = $match[6];
$displayed_gallery = $mapper->find($displayed_gallery_id, TRUE);
}
}
Then inside that loop they should do something like var_dump($displayed_gallery->get_entity()) to see what they're dealing with, or open the browser inspector tools and examine the 'galleries' JS object (we localize the displayed gallery entity there).
If $displayed_gallery->source is 'galleries' then all they need to do is do explode(',' $displayed_gallery->container_ids) and they'll have an array of galleries used
if the source is 'albums' they'll need to inspect container_ids still but any sub-albums have their ID prefixed with 'a' -- so 'a14,14' would be both album:14 and gallery:14
With $content in the first example being the Page/Post content; ATP galleries are custom-posts whose ID is referenced in the preview-image-url
They can also automatically determine the display-type used in ATP via $displayed_gallery->display_type
… and any custom settings used for that display are in $displayed_gallery->display_settings, but it includes all of the settings at the time it was saved, not just a diff from the defaults.