version 6: GPS icon missing from thumbnail caption

Post Reply
fbungarz
Posts: 1668
Joined: 08 Dec 06 5:03
Location: Arizona, USA

version 6: GPS icon missing from thumbnail caption

Post by fbungarz » 28 Apr 21 20:23

Hi Hert,
although I figured out how to display custom captions below the thumbs in version 6, it seems one important caption is not being displayed.
One of the captions would display the letters GPS in red, if an image contained coordinates. That red "GPS" no longer is being displayed.

Here the five lines of captions; 1,2,4 are relatively simple, but line 3 includes a bit of code that previously worked well...
line 1:

Code: Select all

<font color="#FFFFFF" size="20"><i>%xmp:photoshop:Headline</font>
line 2:

Code: Select all

<font color="#FFFFFF" size="20">%xmp:photoshop:Credit %xmp:photoshop:Source</font>
line 3:

Code: Select all

%code
    var
      ACatItem: TCatalogItem;
      ARatingAnchorHref: String;
      ARatingNoColor: String;
      ARatingColor: String;
      ARatingStar: String;
      ARatingOnStar: String;
      ARatingOffStar: String;
      i: Integer;
    begin
      result := '';

      ARatingNoColor := '#CFFF0000'; //#### red color 
      ARatingColor   := '#CFFFFF00'; //#### Yellow color for rating stars
      ARatingStar    := 'M 3.03,4.19883 L 2.996,4.22354 L 3.00909,4.26369 L 2.97501,4.2389 L 2.94086,4.26369 L 2.95394,4.22354 L 2.92,4.19883 L 2.96193,4.19883 L 2.97501,4.1589 L 2.98801,4.19883 L 3.03,4.19883 Z ';

      ARatingAnchorHref := 'code:' +
'  function IsImageItemSelected: Boolean; ' +
'  var ' +
'    i: Integer; ' +
'  begin ' +
'    result := False; ' +
'    for i := 0 to Selected.Count - 1 do ' + 
'    begin ' +
'       if Selected.Items[i].GUID = ImageItem.GUID then ' +
'       begin ' +
'         result := True; ' +
'         exit; ' +
'       end; ' +
'     end; ' +
'  end; ' +
'var ' +
'  i: Integer; ' +
'  ACatItem: TCatalogItem; ' +
'begin ' +
'  if not IsImageItemSelected then ' +
'  begin ' +
'    Selected.Clear; ' +
'    Selected.Add(ImageItem); ' +
'  end; ' +
'' +
'  for i := 0 to Selected.Count - 1 do ' +
'  begin ' +
'     ACatItem := TCatalogItem.Create(nil); ' +
'     if PublicCatalog.FindItemCombinedByGUID(Selected.Items[i].GUID, ACatItem) then ' +
'     begin ' +
'       ACatItem.Rating := #rating#; ' +
'       if PublicCatalog.StoreItemToDataBase(ACatItem, False) then ' +
'         PublicCatalog.UpdateItemSyncState(ACatItem, [], [idcsDBXmp], False, True); ' +
'     end; ' +
'     ACatItem.Free; ' +
'  end; ' +
'end; ' +
'';

      ARatingNoOnStar   := '<a href="' + ARatingAnchorHref + '"><img title="no rating" size="18" path="' + ARatingStar + '" pathfillcolor="' + ARatingNoColor + '" pathstrokestyle="solid" pathstrokecolor="' + ARatingNoColor + '"></a>';
      ARatingNoOffStar  := '<a href="' + ARatingAnchorHref + '"><img size="18" path="' + ARatingStar + '" pathfillstyle="none" pathstrokestyle="solid" pathstrokecolor="' + ARatingNoColor  + '"></a>';
      ARatingOnStar     := '<a href="' + ARatingAnchorHref + '"><img size="18" path="' + ARatingStar + '" pathfillcolor="' + ARatingColor + '" pathstrokestyle="solid" pathstrokecolor="' + ARatingColor + '"></a>';
      ARatingOffStar    := '<a href="' + ARatingAnchorHref + '"><img size="18" path="' + ARatingStar + '" pathfillstyle="none" pathstrokestyle="solid" pathstrokecolor="' + ARatingColor + '"></a>';

      ACatItem := TCatalogItem.Create(nil);
      if PublicCatalog.FindImageCombined (ImageItem, ACatItem, False, vptNone) then
      begin
        result := result + '<font color="'+ ARatingColor +'"><ind y="2">';

        if ACatItem.Rating > 0 then
          result := result + StrTran(ARatingNoOnStar, '#rating#', '0');
        else
          result := result + StrTran(ARatingNoOffStar, '#rating#', '0');

        for i := 1 to ACatItem.Rating do
          result := result + StrTran(ARatingOnStar, '#rating#', IntToStr(i));
        for i := ACatItem.Rating + 1 to 5 do
          result := result + StrTran(ARatingOffStar, '#rating#', IntToStr(i));
        result := result + '</ind></font>';
      end;
      ACatItem.Free;
    end;
    %/code&nbsp;<font color="#FF0000" size="20">%ImageHasGPS{encode=html;replace=No,;replace=Yes,           GPS}
line 4:

Code: Select all

<font size="15><font color="#FFFFFF">%d-%mmm-%yyyy %hh:%nnh</font> <font color="#FFD700">%xmp:dwc:institutionCode %xmp:dwc:catalogNumber</font> <font color="#7CFC00">%xmp:dwc:typeStatus</font></font>

Code: Select all

<body bgcolor="%code
if Catalog.ImageIsVersion(ImageItem) then
  result := '#00FF00'
else if Catalog.ImageHasVersions(ImageItem) then
  result := '#FFFF00'
else
  result := '#000000';
%/code"><FONT size="15"color="#000000">%CatalogPlaceholderList</FONT></body>
I guess the code for line 3 needs to be update so that the red "GPS" will again be displayed for images that contain GPS data?

Thanks,
Frank

Hert
Posts: 6811
Joined: 13 Sep 03 7:24

Re: version 6: GPS icon missing from thumbnail caption

Post by Hert » 29 Apr 21 8:51

Hi Frank, I've copied in your custom lines and the GPS indicator does appear where applicable.
GPS.png
GPS.png (117.4 KiB) Viewed 194 times
I don't know why you have so many spaces in before the GPS indicator, but it could be that that is your issue, causing the GPS indicator to run outside of your thumbnail. Remove (or reduce) the number of spaces.
This is a user-to-user forum. If you need product support then please send a message

fbungarz
Posts: 1668
Joined: 08 Dec 06 5:03
Location: Arizona, USA

Re: version 6: GPS icon missing from thumbnail caption

Post by fbungarz » 29 Apr 21 16:24

Hi Hert,
that did it. By removing the spaces the indicator re-appears, although it is no longer right-aligned. I guess that's what those spaces were for - push it to the right side of the frame, which in version 6 pushed it out, "over the edge"...
Thanks again,
Frank
Last edited by fbungarz on 29 Apr 21 16:27, edited 1 time in total.

Hert
Posts: 6811
Joined: 13 Sep 03 7:24

Re: version 6: GPS icon missing from thumbnail caption

Post by Hert » 29 Apr 21 16:25

I think you added spaces to get it to the right side. You can do that again, most likely a few less spaces than that there were before
This is a user-to-user forum. If you need product support then please send a message


Post Reply