INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Image display Caption expresssion  (Read 2690 times)

rossp

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 772
Image display Caption expresssion
« on: August 05, 2013, 04:58:49 am »

Hi All, I am playing about with tagging images and playing slideshows. I was wondering what Caption expression you all use. Mine is below but does have some drawbacks.

Code: [Select]
[Caption] [Places] -  (formatdate([date,0],dd MMMM yyyy))
[Keywords]
[People]

I do not have all tags filled for each image (who does) so the formatting is often off.
An example:

[Caption] = Uncle Toms Trail - Lower Falls
[Places] = Yellowstone
[Keywords] =
[People] = Ross Gail

Result

Code: [Select]
Uncle Toms Trail - Lower Falls Yellowstone - (28 June 2013)

Gail; Ross

It would be nice to have Keywords excluded as it is blank. People separated by a comma and a comma before Places (unless Places is blank).

Code: [Select]
Uncle Toms Trail - Lower Falls, Yellowstone - (28 June 2013)
Gail, Ross

So I just wondered if any of you clever people have any magic expressions or advice on what you do to tag your images and view the info in a slideshow.

Ross
Logged

rossp

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 772
Re: Image display Caption expresssion
« Reply #1 on: August 05, 2013, 05:25:39 am »

OK, with as a bit of playing around the following gets me:

Code: [Select]
[Caption] if(isempty([Places]),,/,[Places])  -  (formatdate([date,0],dd MMMM yyyy))
[Keywords]
Replace([People],;,/,)

Code: [Select]
Uncle Toms Trail - Lower Falls ,Yellowstone - (28 June 2013)

Gail, Ross

but I still can't get rid of the blank line  ;(
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Image display Caption expresssion
« Reply #2 on: August 05, 2013, 11:28:37 am »

Every physical line in a caption or thumbnail text expression outputs a corresponding line in the caption or thumbnail.

That said, I don't see how your caption above could produce 3 lines.
Logged
The opinions I express represent my own folly.

rossp

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 772
Re: Image display Caption expresssion
« Reply #3 on: August 05, 2013, 12:32:31 pm »

Edited the original post, missed the [Keywords] out.
Logged

rossp

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 772
Re: Image display Caption expresssion
« Reply #4 on: September 04, 2013, 03:31:57 am »

This is a better caption expression as it keeps all the info on one line.

Code: [Select]
[Caption]if(isempty([Places]),,/, [Places]) if(isempty([People]),,/ [replace([People],;,/,)]) - (formatdate([date,0],dd MMMM yyyy))

eg

Code: [Select]
[Caption] = Uncle Toms Trail - Lower Falls
[Places] = Yellowstone
[People] = Ross Gail

output

Code: [Select]
Uncle Toms Trail - Lower Falls, Yellowstone [Gail, Ross] - (28 June 2013)

Ross
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Image display Caption expresssion
« Reply #5 on: September 04, 2013, 12:38:09 pm »

If you're going to use a single line, you might want to avoid extraneous separator characters when items are empty.  Treat each segment as an item in a list, each separated by some separator character.  ListBuild() helps accomplish this by outputting the separator sequence in between non-empty items.

So you have 2 items separated by ", ", and one of those items is a list separated by " " and the other by " - ".  This means you need 3 listbuilds().  The delimit() function can handle adding the brackets/parens around people/date when people/date is not empty.

Code: [Select]
listbuild(1, /,/ ,[Caption], listbuild(1, / -/ , listbuild(1, / , [Places], replace(delimit([People], ], [),;,/,)),delimit(formatdate([date,0],dd MMMM yyyy), /), /()))
and that breaks down to:

listbuild(1, /,/ ,
  [Caption],
  listbuild(1, / -/ ,
      listbuild(1, / , [Places], replace(delimit([People], ], [),;,/,)),
      delimit(formatdate([date,0],dd MMMM yyyy), /), /()))
Logged
The opinions I express represent my own folly.

rossp

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 772
Re: Image display Caption expresssion
« Reply #6 on: September 04, 2013, 01:01:09 pm »

Hi MrC,

With yours I get

Uncle Toms Trail - Lower Falls, [Gail, Ross] - (28 June 2013)

when [Places] is empty. With mine the comma is omitted.

Uncle Toms Trail - Lower Falls [Gail, Ross] - (28 June 2013)

That is why I used the isempty statement, I could use delimit around [Places] I suppose.

Ross
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Image display Caption expresssion
« Reply #7 on: September 04, 2013, 01:09:18 pm »

It wasn't clear to me when the separators should be output.  The expression was just an example of how to omit unwanted separators.

Try yours with an empty Caption but non-empty Places.
Logged
The opinions I express represent my own folly.

rossp

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 772
Re: Image display Caption expresssion
« Reply #8 on: September 04, 2013, 03:14:06 pm »

Yes I see what you mean Master. I will try to modify yours to get the best result. Thanks for the tip.

Ross
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Image display Caption expresssion
« Reply #9 on: September 04, 2013, 04:48:45 pm »

Please share what you come up with!
Logged
The opinions I express represent my own folly.

rossp

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 772
Re: Image display Caption expresssion
« Reply #10 on: September 05, 2013, 03:35:44 am »

OK I think I have it (although I did modify mine with your lovely delimit function MrC),

Code: [Select]
if(isempty([Places]),[Caption],delimit([Caption],/,,)) [Places] if(isempty([People]),,/ [replace([People],;,/,)]) - (formatdate([date,0],dd MMMM yyyy))

This will output:
Uncle Toms Trail - Lower Falls, Yellowstone [Gail, Ross] - (28 June 2013)
Uncle Toms Trail - Lower Falls [Gail, Ross] - (28 June 2013)
Uncle Toms Trail - Lower Falls - (28 June 2013)
(28 June 2013)

depending on what [Caption] [Places] and [People] have as values.

Most complicated expression I have made (with help of course)

Ross
Logged

icstm

  • World Citizen
  • ***
  • Posts: 150
Re: Image display Caption expresssion
« Reply #11 on: September 05, 2013, 06:32:00 am »

Thanks for sharing.
I love building simple expressions, I really struggle to follow these longer ones

eg your:
[replace([People],;,/,)]
Logged

rossp

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 772
Re: Image display Caption expresssion
« Reply #12 on: September 05, 2013, 06:34:34 am »

If [People] = Ross; Gail

then  [replace([People],;,/,)]

will result in

[Ross, Gail]

or replace([People],;,/,)

will result in

Ross, Gail


Hope that helps

Ross
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Image display Caption expresssion
« Reply #13 on: September 05, 2013, 10:55:48 am »

A nice trick, by the way, if you want to build lists like these, and reduce the number of ListBuild() operations, is to use the same delimiter throughout.  If you can live with that, you're done.  If not, then you can Replace() them if necessary, from left to right.

Instead of:

    A, B - C

you create

    A:::B:::C

and fix up the ::: separators in this order:

    A, B:::C

    A, B - C

This introduces the simpler (for most folks) Replace() command instead of the extra surrounding ListBuild().  Or, if the lists are of known length, Regex() can replace the ::: separators in one shot.  Just some additional ways to do it.
Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up