var
AProps: TCatalogItemProps;
AProp: TCatalogItemProp;
AHtml: TTntStringList;
begin
AProps := TCatalogItemProps.Create(TCatalogItemProp, '');
PublicCatalog.EnumPropsForParent(PeopleGUID, AProps, True, False);
AProps.Disconnect;
// remove props without image
for i := AProps.Count - 1 downto 0 do
begin
AProp := AProps.Items[i];
if AProp.Image.Size = 0 then
AProp.Free;
end;
PublicCatalog.PathNameForProps(AProps, '::', False);
// sort the props
AProps.Sort('Name', stAscending);
AHtml := TTntStringList.Create;
AHtml.Add('<html>');
AHtml.Add('<head>');
AHtml.Add('<style>');
AHtml.Add('body {font-family: helvetica; background-color: #000; color:#fff}');
AHtml.Add('.image {background-color: #202020; text-align: center;}');
AHtml.Add('.name {text-align: left; vertical-align: top;}');
AHtml.Add('.hierarchical {text-align: left; vertical-align: top;}');
AHtml.Add('.faceimage {max-width: 200px; max-height: 200px;}');
AHtml.Add('</style>');
AHtml.Add('</head>');
AHtml.Add('<body>');
AHtml.Add('<h2>Catalog Labels with Faces</h2>');
AHtml.Add('<table>');
AHtml.Add('<tr>');
AHtml.Add('<th class="image">');
AHtml.Add('Image');
AHtml.Add('</th>');
AHtml.Add('<th class="name">');
AHtml.Add('Name');
AHtml.Add('</th>');
AHtml.Add('<th class="hierarchical">');
AHtml.Add('Hierarchical Name');
AHtml.Add('</th>');
AHtml.Add('</tr>');
for i := 0 to AProps.Count - 1 do
begin
AProp := AProps.Items[i];
AHtml.Add('<tr>');
AHtml.Add('<td class="image">');
AHtml.Add('<img class="faceimage" src="data:image/jpeg;base64,' + Base64EncodeStream(AProp.Image) + '">');
AHtml.Add('</td>');
AHtml.Add('<td class="name">');
AHtml.Add(AProp.PropName);
AHtml.Add('</td>');
AHtml.Add('<td class="hierarchical">');
AHtml.Add(AProp.Name);
AHtml.Add('</td>');
AHtml.Add('</tr>');
end;
AHtml.Add('</table>');
AHtml.Add('</body>');
AHtml.Add('</html>');
AHtml.SaveToFile(WindowsTempDir + 'props.htm');
ShellDoExecute(0, WindowsTempDir + 'props.htm');
AHtml.Free;
AProps.Free;
end;
|