var
i: Integer;
AAreas: TCatalogAreas;
AArea: TCatalogArea;
ACatItem: TCatalogItem;
AProp: TCatalogItemProp;
AHtml: TTntStringList;
ASl: TTntStringList;
begin
AAreas := TCatalogAreas.Create(TCatalogArea, '');
PublicCatalog.EnumAllAreasWithFeatures(AAreas);
AAreas.Disconnect;
ASl := TTntStringList.Create;
try
// remove areas that are not "confirmed"
for i := AAreas.Count - 1 downto 0 do
begin
AArea := AAreas.Items[i];
if (not AArea.HasFaceFeatures) or (AArea.PropGUID = '') then
AArea.Free;
ACatItem := TCatalogItem.Create(nil);
AProp := TCatalogItemProp.Create(nil);
if PublicCatalog.FindItemCombinedByGUID(AArea.ItemGUID, ACatItem) then
begin
AArea.Name := ACatItem.FileName;
if PublicCatalog.EnumProp(AArea.PropGUID, AProp, False) then
ASl.AddObject(AProp.PropName + '.' + ACatItem.FileName, AArea);
end;
AProp.Free;
ACatItem.Free;
end;
// sort the areas
ASl.Sort;
for i := 0 to ASl.Count - 1 do
begin
AArea := ASl.Objects[i];
AArea.Index := i;
end;
finally
ASl.Free;
end;
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>Confirmed 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="name">');
AHtml.Add('File Name');
AHtml.Add('</th>');
AHtml.Add('</tr>');
for i := 0 to AAreas.Count - 1 do
begin
AArea := AAreas.Items[i];
AHtml.Add('<tr>');
AHtml.Add('<td class="image">');
AHtml.Add('<img class="faceimage" src="data:image/jpeg;base64,' + Base64EncodeStream(AArea.Image) + '">');
AHtml.Add('</td>');
AHtml.Add('<td class="name">');
AHtml.Add(AArea.Caption);
AHtml.Add('</td>');
AHtml.Add('<td class="name">');
AHtml.Add(AArea.Name);
AHtml.Add('</td>');
AHtml.Add('</tr>');
end;
AHtml.Add('</table>');
AHtml.Add('</body>');
AHtml.Add('</html>');
AHtml.SaveToFile(WindowsTempDir + 'confirmed.htm');
ShellDoExecute(0, WindowsTempDir + 'confirmed.htm');
AHtml.Free;
AAreas.Free;
end;
|