some Custom Thumb Info no longer working

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

some Custom Thumb Info no longer working

Post by fbungarz » 23 Aug 18 17:32

Hi,
I have been using the following Custom Thumb Info for years to display date, DarwinCore Institution Code, DarwinCore Catalog Number and DarwinCore TypeStatus below my thumbnails. In PSu 4 the size that the Custom Thumb Info gets displayed is much smaller, presumably as a result of the high resolution screen support.
That would be fine, if simply increasing the font size would talk care of this. But unfortunately that does not work. The data still gets displayed at the left, but the DarwinCore fields are cut off.

The reason for this is apparently that, if the DarwinCore fields are empty, no longer the field content (= nothing) gets displayed, but instead of that the html tags that define the fields.

Any suggestions?
Here the code for the Custom Thumb Info

Code: Select all

<font color="#FFFFFF" size="8">%d{encode=html}-%mmm{encode=html}-%yyyy{encode=html} %hh{encode=html}:%nn{encode=html} h</font> <font color="#FFD700"size="8">%xmp:dwc:institutionCode %xmp:dwc:catalogNumber</font> <font color="#7CFC00"size="8">%xmp:dwc:typeStatus</font> 
Thank you,
Frank
Last edited by fbungarz on 28 Aug 18 0:45, edited 1 time in total.

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

Re: some Custom Thum Info no longer working

Post by fbungarz » 23 Aug 18 17:46

Two screenshots to illustrate, what I am talking about:
CustomThumbInfo.jpg
CustomThumbInfo.jpg (215.64 KiB) Viewed 1477 times
CustomThumbInfo_2.jpg
CustomThumbInfo_2.jpg (207.44 KiB) Viewed 1477 times

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

Re: some Custom Thum Info no longer working

Post by fbungarz » 23 Aug 18 17:50

BTW: There seems to be a maximum of 5 Custom Thumb Info lines, I am using them all. So adding just another line unfortunately is not an option.

LINE 1

Code: Select all

<font color="#FFFFFF" size="20"><i>%xmp:dc:Title<></font>
LINE 2

Code: Select all

%code
var
  ACatItem: TCatalogItem;
  AVal: WideString;
begin
  result := ToWideString('');

  ACatItem := TCatalogItem.Create(nil);

  if Catalog.FindImageCombined (ImageItem, ACatItem, False, vptNone) then
  begin
    AVal := ToWideString('');
    if Catalog.FindXMPCachedTagValueForItem (ACatItem, 'photoshop:Credit', AVal) then
      result := result + '<FONT color="#FFFFFF" size="20">' + AVal + ' ';

    AVal := ToWideString('');
    if Catalog.FindXMPCachedTagValueForItem (ACatItem, 'photoshop:Source', AVal) then
      result := result + '<FONT color="#FFFFFF" size="20">' + AVal + '</FONT>';
  end;

  ACatItem.Free;
end;
%/code
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

<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>
LINE 5

Code: Select all

<font color="#FFFFFF" size="12">%d{encode=html}-%mmm{encode=html}-%yyyy{encode=html} %hh{encode=html}:%nn{encode=html}h</font> <font color="#FFD700"size="12">%xmp:dwc:institutionCode %xmp:dwc:catalogNumber</font> <font color="#7CFC00"size="12">%xmp:dwc:typeStatus</font> 
Not sure, if some can perhaps be simplified.

Thanks again,

Frank

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

Re: some Custom Thumb Info no longer working

Post by fbungarz » 28 Aug 18 1:11

Sadly, this is till unresolved in built 1631 :(
The attachment PSU_CustomThumbInfo_1.jpg is no longer available
The attachment PSU_CustomThumbInfo_2.jpg is no longer available
PSU_CustomThumbInfo_1.jpg
PSU_CustomThumbInfo_1.jpg (222.07 KiB) Viewed 1420 times

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

Re: some Custom Thumb Info no longer working

Post by Hert » 28 Aug 18 8:33

None of my images have DWC fields and when I copy in your line 5 then it only displays the date. All looks good to me.

If font is displayed at size 8, then that is what you defined in the custom field.

Here's line 5 cleaned up and at a bigger size

Code: Select all

<font size="16"><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>
This is a User-to-User forum which means that users post questions here for other users.
Feature requests, change suggestions, or bugs can be logged in the ticketing system

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

Re: some Custom Thumb Info no longer working

Post by fbungarz » 28 Aug 18 17:36

Strange...
Using your "cleaned code" I still have the same result.
The HTML tags, however, only show up, when you use a small enough font (8 and smaller). Have you actually tried this?
If you use a larger font the HTML is essentially pushed out of the visible area below the thumb and thus won't show up...

I can send you a test image.

sanphotgn
Posts: 469
Joined: 26 Aug 07 18:06

Re: some Custom Thumb Info no longer working

Post by sanphotgn » 28 Aug 18 19:56

I can't help but think the URLs are related to this Mantis ticket: https://mantis.idimager.com/view.php?id=3112
Photo Supreme 3.3.0.2602 (64 bits) (Windows)

sanphotgn
Posts: 469
Joined: 26 Aug 07 18:06

Re: some Custom Thumb Info no longer working

Post by sanphotgn » 28 Aug 18 20:43

A test.

I enabled the Darwin Core in Details.

On two images, I entered data. Clicked on OK. Deleted the data. Clicked on OK. Repeated. Was trying to see if any of my changes to the custom thumb script impacted the display. The one thing I noticed: the URLs.

I highlighted the two images I was using and I exported (to CSV) the fields where I entered and changed data. I also exported some Darwin Core fields I didn't touch.

CSV result: If the fields didn't have data, the fields contained URLs similar to this:

Code: Select all

http://rs.tdwg.org/dwc/index.htm:Record.dwc:institutionID
I highlighted an image just below these two images. I did not use this image for the above tests, thus all Darwin Core fields are empty. I exported (to CSV) the same fields.

CSV result: all fields are blank.
Hert wrote:
28 Aug 18 8:33
None of my images have DWC fields and when I copy in your line 5 then it only displays the date. All looks good to me.
This latest test is consistent with the Mantis ticket and Hert's results. There is a point in the workflow that changes everything. Before that point fields without values will be blank when referenced in scripts (custom thumb info, export, ...) and after that point fields without values will contain URLs.
Photo Supreme 3.3.0.2602 (64 bits) (Windows)

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

Re: some Custom Thumb Info no longer working

Post by fbungarz » 28 Aug 18 22:05

Hi Sanphotgn,
that actually makes sens. Only, in my case I have never used "export to CSV " on these images. BUT, a lot of my labels are written to DwC fields and this means that essentially all my images contain DwC XMP as part of their metadata.
I can only guess that this results in the URLs of the html tags that define these fields are being displayed if the image contains ][any] Darwin Core metadata. I don't think the actual html tags are written as XMP content to the metadata of the images, though. At least I cannot see these tags in ExifTool. But it seems that PSu "pretents" that these tags are there if any DwC data are present in the XMP of these images. Thus, PSu essentially displays the html tags as "placeholders" for these fields instead of showing the content of these fields as empty. It seems that this bug was in fact only recently introduced (as you mention in your Mantis ticket https://mantis.idimager.com/view.php?id=3112).
Cheers,
Frank

sanphotgn
Posts: 469
Joined: 26 Aug 07 18:06

Re: some Custom Thumb Info no longer working

Post by sanphotgn » 28 Aug 18 23:32

fbungarz wrote:
28 Aug 18 22:05
I don't think the actual html tags are written as XMP content to the metadata of the images, though. At least I cannot see these tags in ExifTool.
Correct. I have not found them written as XMP to the metadata.


Here is another test.

Different images.

I take one image.

I use Hert's custom thumbnail script, but I am going to set the font at 8, because as fbungarz pointed out, you can't see everything that is going on.

I enter a value for %xmp:dwc:institutionCode.

The thumbnail display should be: date, time, and my value for %xmp:dwc:institutionCode.

The thumbnail display is: date, time, my value for %xmp:dwc:institutionCode, the URL for catalogNumber, and the URL for typeStatus.

I enter a value for %xmp:dwc:catalogNumber.

The thumbnail display is: date, time, my value for %xmp:dwc:institutionCode, my value for %xmp:dwc:catalogNumber, and the URL for typeStatus.

I enter a value for %xmp:dwc:typeStatus.

The thumbnail display is: date, time, my value for %xmp:dwc:institutionCode, my value for %xmp:dwc:catalogNumber, and my value for %xmp:dwc:typeStatus.

If I remove the values in reverse order, there are no surprises in the thumbnail displays.

Must change font size to four to see what is going on in this next part of the test.

I re-enter the values so the thumbnail display looks perfect.

I remove the value for %xmp:dwc:institutionCode.

The thumbnail display is: date, time, the URL for institutionCode, and the URL for catalogNumber and typeStatus (even though there are values for both of these).

I enter a value for %xmp:dwc:institutionCode.

Thumbnail display looks perfect again.

I remove the value for %xmp:dwc:catalogNumber.

The thumbnail display is: date, time, my value for %xmp:dwc:institutionCode, the URL for catalogNumber and typeStatus (even though there is a value for %xmp:dwc:typeStatus).
Photo Supreme 3.3.0.2602 (64 bits) (Windows)

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

Re: some Custom Thumb Info no longer working

Post by fbungarz » 29 Aug 18 0:47

Thanks for testing it. I can confirm all this.
For my particular workflow this is all a bit annoying, because it means I can never be sure if certain data has been entered into these fields or not. The html tags are simply so large that they will push existing data in other fields out of the visible area of the thumbs - unless a font as small as UTF8 is selected. However, then this font is basically illegible - unless I am increasing thumb size to 200% [which is not an efficient use of my screen real estate (only two thumbs being displayed side-by-side)].
:?
It would be great to get this fixed.
Thanks!!!

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

Re: some Custom Thumb Info no longer working

Post by Hert » 03 Sep 18 12:43

You can install build 1640 from the website. It fixes this
This is a User-to-User forum which means that users post questions here for other users.
Feature requests, change suggestions, or bugs can be logged in the ticketing system

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

Re: some Custom Thumb Info no longer working

Post by fbungarz » 05 Sep 18 16:32

Thanks!
Is there a reason, why this version does not trigger PSu's auto-update?
The "check for update" also does not find this version. Perhaps the changes are too minor?

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

Re: some Custom Thumb Info no longer working

Post by fbungarz » 05 Sep 18 16:33

I can confirm that this now works in 1640. Thanks for fixing it so promptly !!!

Post Reply