Resource

Resource Basics

Resource Name Search Items with Off Image Areas
Resource Version 1.0
Category Search Scripts
Downloads 595
Release Date 2/3/2024 10:02:26 AM
 

Resource Details

Description This script will return:
All images that have areas defined for them that are located outside of the image bounds, or that overlaps the complete image.
Installation Instructions na
Usage Instructions 1. In Photo Supreme, click the dropdown in the Tab Bar above the thumbs
2. Select From Repository and then this script
Changes in this version na
Special Requirements
 

Author Information

Author Name IDimager Support
 

Script

  function MainFilter: WideString;
  begin
    result := 'select GUID ' +
              'from   idCatalogItem i ' +
              'where  exists (select 1 from idImageArea a where a.ImageGUID = i.GUID and ((a.idPosRight < 0) or (a.idPosLeft > 1) or (a.idPosBottom < 0) or (a.idPosTop > 1) or ((a.idPosTop < 0) and (a.idPosLeft < 0) and (a.idPosRight > 1) and (a.idPosBottom > 1))))  ' +
              'union all ' +
              'select GUID ' +
              'from   idImageVersion i ' +
              'where  exists (select 1 from idImageArea a where a.ImageGUID = i.GUID and ((a.idPosRight < 0) or (a.idPosLeft > 1) or (a.idPosBottom < 0) or (a.idPosTop > 1) or ((a.idPosTop < 0) and (a.idPosLeft < 0) and (a.idPosRight > 1) and (a.idPosBottom > 1))))  ' +
              '';
    end;


var
  ADs: TDBXOMClientDataSet;
begin
  ADs := PublicCatalog.NewDataset;

  ADs.CommandText := 'select ' + PublicCatalog.FullColumnList('i.') + ' ' +
                     'from   v_catalogitem i ' +
                     'inner join (' + MainFilter + ') as f on f.GUID = i.GUID ' +
                     'UNION ALL ' +
                     'select ' + PublicCatalog.FullColumnList('i.') + ' ' +
                     'from   v_catalogitemversion i ' +
                     'inner join (' + MainFilter + ') as f on f.GUID = i.GUID ' +
                     '';
  ADs.LockType := ReadLockType;
  ADs.OpenSet
  try
    AData := TidElement.Create(nil);
    try
      PublicBroadCast(nil, 'OpenNewTab', nil);
      PublicBroadCastRequest(nil, 'ActiveCollection', AData);
      AColl := AData.Data;
      AColl.Clear;
      AColl.Items.AddDataset(ADs, True);
      PublicBroadCast(nil, 'RefreshActiveCollection', nil);
    finally
      AData.Free;
    end;
  finally
    ADs.CloseSet;
  end;

  PublicCatalog.FreeDataset(ADs);
end;