INTERACT FORUM

Please login or register.

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

Author Topic: Image Caption challenge (Marko?)  (Read 14114 times)

RobOK

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 615
  • long time MC user for PC, iPod and Tivo
Image Caption challenge (Marko?)
« on: August 09, 2006, 10:00:24 am »

I have a veiw scheme of my daughter as she is growing (8 months already!) and want a caption that shows her age.

Basic:  a caption to show her age in days (I think I can get that one working)


Challenge:

for pics in the first 8 weeks, i would like the caption to be "n Weeks"
for pics in months 2-12, "n Months"
for anything greather, "n Years"

Her birthday is Nov 21, 2005

Any takers?


Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Image Caption challenge (Marko?)
« Reply #1 on: August 09, 2006, 12:06:59 pm »

spooky!
something along these lines was already on my 'list of things to do'

As my granddaughter is getting on for 30 months old now, I was thinking of trying to work out a smartlist that would pick out a few choice photos from each month, and include her age in the caption...

I haven't started yet. I'm not sure if it's even possible. Just 300 old photos left to tag, then I'll make some playtime...

RobOK

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 615
  • long time MC user for PC, iPod and Tivo
Re: Image Caption challenge (Marko?)
« Reply #2 on: August 09, 2006, 01:12:08 pm »

I have since read that you cannot do Math in expressions, is that right?  If so, not sure how it would work.

Is that true, no math?
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Image Caption challenge (Marko?)
« Reply #3 on: August 09, 2006, 01:50:40 pm »

yes, no math, but until I've had a closer look, I'm not ready to say 'not possible' ;)

RobOK

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 615
  • long time MC user for PC, iPod and Tivo
Re: Image Caption challenge (Marko?)
« Reply #4 on: August 09, 2006, 05:15:56 pm »

I did come up with a scheme in Excel that could be helpful, but it would be very tedious without math.

Let's call the Birthday of the baby BDAY and you are comparing the Date Created of the image, I'll call DATE.

Check if DATE <=  BDAY , then picture predates baby, else

If DATE< BDAY + 7, "Baby is a week or less"   (Note, since BDAY is a constant, you add 7 to it and type that into the formula as a literal date.

else, if  DATE<BDAY + 30, "Baby is a month or less"

else, if DATE < BDAY + 90 "Baby is 2-3 months"

else if DATE < BDAY + 180

365

etc.

etc.

That would be a super nested IF statement.

if([Date Created]>"11/20/2005","A","B")   <------    what is the syntax for comparing a Date Field to a date literal?

Thanks!
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Image Caption challenge (Marko?)
« Reply #5 on: August 10, 2006, 01:29:15 pm »

with all 4000 odd photos now with basic tags in place, I keep my promise to myself and play a little before going back in to fine tune things.

this is a nice start (not got to captions yet, still at the list creation stage):

[year - month] is where it all happens. It's a custom field, so you'll need to create it. It's a calculated field, use the following template:

formatdate([date,0],yy - MM)

~limit=-1,1,[year - month] says: take all the files in the list, and return just one from each month.
the sort rule at the end sorts them from oldest to newest.
which gives us with the following rule that can be easily tweaked to work for everyone. adjust the people value, and the second number in the limit rule to suit:

[media type]=image [people]=vada ~limit=-1,1,[year - month] ~sort=[year - month]

now the hard part...
has anyone come up with anything else for captions yet, or are we starting from scratch?

I do believe we are looking at the mother of all if() statements  :o

RobOK

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 615
  • long time MC user for PC, iPod and Tivo
Re: Image Caption challenge (Marko?)
« Reply #6 on: August 10, 2006, 02:46:29 pm »

Would you make the IF statement in the Caption itself, or would you make it its own new database field?

I'm new to the expressions and custom fields, so I don't know the pro's and con's.

I am thinking that it would be better for performance as a field so it is calculated once per image, not everytime the captions are displayed.

But then that massive IF would get evaluated for all the audio files too, which doesnt make sense.  I guess the first part of the IF could eliminate audio files so they would evaluate faster.


I like the idea of pulling them by YY-MM, although the way my picture taking goes, I might have a lot of good pictures from several sessions in one month and then go two months without taking a picture at all.   So I would probably use Ratings as the selection.  Not sure, have to try it.


I have about 9000 images, most not tagged or organized.  I got a Nikon D70s DSLR last year and that has ballooned my number of images.  But it might be 10 or 20 of nearly the identical image, just shooting a bunch to get the "right shot".  I should do better at deleting the bad ones right away.  Sometimes I shoot in RAW (called NEF in Nikon world) and that creates two files for each image (NEF and JPG), which also increases the file count.   

That's why for me, I am only going to find the good ones and give them 4 or 5 stars and just deal with that small subset for everything else.

Cheers


Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Image Caption challenge (Marko?)
« Reply #7 on: August 10, 2006, 04:58:42 pm »

I'm thinking we might be able to cut down on the if() questions if we turn the date into a number. Then we can do numerical compares such as less than or equal to, greater than or equal to, and so on.....

Quote
Challenge:

for pics in the first 8 weeks, i would like the caption to be "n Weeks"
for pics in months 2-12, "n Months"
for anything greather, "n Years"

Her birthday is Nov 21, 2005

which would require 18 or 19 'ifs'....


RobOK

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 615
  • long time MC user for PC, iPod and Tivo
Re: Image Caption challenge (Marko?)
« Reply #8 on: August 10, 2006, 06:19:59 pm »

Yeah, I am going to tone it down a little.  In the short term, I am simply going to name albums with her age (roughly the same as creating a custom field) in rough buckets:

Newborn
Under 1 month
2-3 months
4-5 months
6-9 months
10-12 months
1 year

About like that.  Sorting all of them by date, I can quickly set this up en masse.  Not as elegant as a bunch of nested IFs, but quick results.

Later I can implement an algorithmic way.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Image Caption challenge (Marko?)
« Reply #9 on: August 10, 2006, 06:59:53 pm »

 ::)
wish I'd read that first!!! This made my head hurt. I used Vada's dates because they're more familiar to me, and your rules...

her birthday is 07/04/04 (7th April 2004)

[numbers] is created from formatdate([date,0],yyMMdd)

and this expression takes care of things up to 9 months old...

if(isequal([date],07//04//,8),Vada's birthday,if(isequal([date],08//04//2004,8),1 day old,if(isequal([date],09//04//2004,8),2 days old,if(isequal([date],10//04//2004,8),3 days old,if(isequal([date],11//04//2004,8),4 days old,if(isequal([date],12//04//2004,8),5 days old,if(isequal([date],13//04//2004,8),6 days old,if(isequal([numbers],040420,4),1 week old,if(isequal([numbers],040427,4),2 weeks old,if(isequal([numbers],040504,4),3 weeks old,if(isequal([numbers],040511,4),4 weeks old,if(isequal([numbers],040518,4),5 weeks old,if(isequal([numbers],040525,4),6 weeks old,if(isequal([numbers],040601,4),7 weeks old,if(isequal([numbers],040608,4),8 weeks old,if(isequal([numbers],040706,4),2 months old,if(isequal([numbers],040806,4),3 months old,if(isequal([numbers],040906,4),4 months old,if(isequal([numbers],041006,4),5 months old,if(isequal([numbers],041106,4),6 months old,if(isequal([numbers],041206,4),7 months old,if(isequal([numbers],050106,4),8 months old,if(isequal([numbers],050206,4),9 months old,[date])))))))))))))))))))))))



-marko.

RobOK

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 615
  • long time MC user for PC, iPod and Tivo
Re: Image Caption challenge (Marko?)
« Reply #10 on: August 10, 2006, 07:36:30 pm »

YOU ARE CRAZY!!!!


I'll move to your formula at some point, BUT NOT TONIGHT!
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Image Caption challenge (Marko?)
« Reply #11 on: August 11, 2006, 04:44:43 am »

finished this off this morning. this takes care of things until she reaches 5 years old....

if(isequal([date],07//04//,8),Vada's birthday,if(isequal([date],08//04//2004,8),1 day old,if(isequal([date],09//04//2004,8),2 days old,if(isequal([date],10//04//2004,8),3 days old,if(isequal([date],11//04//2004,8),4 days old,if(isequal([date],12//04//2004,8),5 days old,if(isequal([date],13//04//2004,8),6 days old,if(isequal([numbers],040420,4),1 week old,if(isequal([numbers],040427,4),2 weeks old,if(isequal([numbers],040504,4),3 weeks old,if(isequal([numbers],040511,4),4 weeks old,if(isequal([numbers],040518,4),5 weeks old,if(isequal([numbers],040525,4),6 weeks old,if(isequal([numbers],040601,4),7 weeks old,if(isequal([numbers],040608,4),8 weeks old,if(isequal([numbers],040706,4),2 months old,if(isequal([numbers],040806,4),3 months old,if(isequal([numbers],040906,4),4 months old,if(isequal([numbers],041006,4),5 months old,if(isequal([numbers],041106,4),6 months old,if(isequal([numbers],041206,4),7 months old,if(isequal([numbers],050106,4),8 months old,if(isequal([numbers],050206,4),9 months old,if(isequal([numbers],050306,4),10 months old,if(isequal([numbers],050406,4),11 months old,if(isequal([numbers],050506,4),1 year old,if(isequal([numbers],050606,4),13 months old,if(isequal([numbers],050706,4),14 months old,if(isequal([numbers],050806,4),15 months old,if(isequal([numbers],050906,4),16 months old,if(isequal([numbers],051006,4),17 months old,if(isequal([numbers],051106,4),18 months old,if(isequal([numbers],051206,4),19 months old,if(isequal([numbers],060106,4),20 months old,if(isequal([numbers],060206,4),21 months old,if(isequal([numbers],060306,4),22 months old,if(isequal([numbers],060406,4),23 months old,if(isequal([numbers],070406,4),2 years old,if(isequal([numbers],080406,4),3 years old,if(isequal([numbers],090406,4),4 years old,if(isequal([numbers],100406,4),5 years old,[date])))))))))))))))))))))))))))))))))))))))))

My good lady wife reliably informed me that usually, women like to report their baby's age in months up to their 2nd birthday, so, that's what I did. It's actually pretty cool, and MC12 doesn't flinch when translating it. It's also quite easy to realise if you use a text editor with column editing abilities. I laid this out in columns first, then got the program to do the incremental numbers, and finally, removed the line breaks to put it all in one string. sorted.
The mind numbing part is at the start, when you try to get the dates right. I got them wrong the first time  ::)

Rob, if you let me know how your dates are formatted in MC, it'll only take a minute for me to adjust this for you to use.
Mine default to dd/MM/yyyy : time

-marko.

RobOK

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 615
  • long time MC user for PC, iPod and Tivo
Re: Image Caption challenge (Marko?)
« Reply #12 on: August 11, 2006, 06:35:59 am »

I'm not certain where Date Formatting is set in MC.  I think it is picked up from Windows/OS?

Mine are:   YYYY-MM-DD : time

And my daughter's b-day is 2005-11-20 !

So do you use this in the caption or did you make it a new database field?

Rob.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Image Caption challenge (Marko?)
« Reply #13 on: August 11, 2006, 07:47:17 am »

yup, I'm sure it is from the OS too. The first few 'ifs' require a match on the date field, which is why I asked. You don't need to change anything.
as far as I can tell, we can't easily compare dates, as dates, using expressions, so, you will need to create a new database field.

Call it numbers
It will be a calculated field, the template to use is: formatdate([date,0],yyMMdd)

This will create a field, [numbers], derived from the date, and now, we can compare because 'ifs' come with a numerical "less than or equal to" compare.

Was your daughter born on the 20th, or the 21st? (see your 1st post)
-marko.

RobOK

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 615
  • long time MC user for PC, iPod and Tivo
Re: Image Caption challenge (Marko?)
« Reply #14 on: August 11, 2006, 09:39:01 am »

20th, the first one was a typo.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Image Caption challenge (Marko?)
« Reply #15 on: August 11, 2006, 02:11:54 pm »

here you go:

Working on the massive presumption that you have your [people] tags set on your photos, the following expression will give you the following:
If Aisling is in the [people] tag, the caption will show, for example:

(Aisling, aged 4 months) 3 April 2006

If Aisling does not feature in the picture, it will output the date alone, like so: (3 April 2006)

It can be used as both thumbnail text in the 'customise current view' dialogue, and the "Caption" field in the 'Image playback' settings.
It's good until Aisling's 5th birthday, after which, it will prompt you to "Fix the caption" :)
If you like, you can right-click HERE and 'save target as...'. It's a text file with the expression as shown below, and also in columns, which makes it easier to follow.

It was a pleasure to work on, I hope it cuts it for you too.

(if(isequal([people],aisling,8),if(isequal([date],2005//11//20,8),Aisling's birthday,if(isequal([date],2006//11//20,8),Aisling's 1st birthday,if(isequal([date],2007//11//20,8),Aisling's 2nd birthday,if(isequal([date],2008//11//20,8),Aisling's 3rd birthday,if(isequal([date],2009//11//20,8),Aisling's 4th birthday,if(isequal([date],2010//11//20,8),Aisling's 5th birthday,if(isequal([date],2005//11//21,8),Aisling/, aged 1 day,if(isequal([date],2005//11//22,8),Aisling/, aged 2 days,if(isequal([date],2005//11//23,8),Aisling/, aged 3 days,if(isequal([date],2005//11//24,8),Aisling/, aged 4 days,if(isequal([date],2005//11//25,8),Aisling/, aged 5 days,if(isequal([date],2005//11//26,8),Aisling/, aged 6 days,if(isequal([numbers],051203,4),Aisling/, aged 1 week,if(isequal([numbers],051210,4),Aisling/, aged 2 weeks,if(isequal([numbers],051217,4),Aisling/, aged 3 weeks,if(isequal([numbers],051224,4),Aisling/, aged 4 weeks,if(isequal([numbers],051231,4),Aisling/, aged 5 weeks,if(isequal([numbers],060107,4),Aisling/, aged 6 weeks,if(isequal([numbers],060114,4),Aisling/, aged 7 weeks,if(isequal([numbers],060121,4),Aisling/, aged 8 weeks,if(isequal([numbers],060219,4),Aisling/, aged 2 months,if(isequal([numbers],060319,4),Aisling/, aged 3 months,if(isequal([numbers],060419,4),Aisling/, aged 4 months,if(isequal([numbers],060519,4),Aisling/, aged 5 months,if(isequal([numbers],060619,4),Aisling/, aged 6 months,if(isequal([numbers],060719,4),Aisling/, aged 7 months,if(isequal([numbers],060819,4),Aisling/, aged 8 months,if(isequal([numbers],060919,4),Aisling/, aged 9 months,if(isequal([numbers],061019,4),Aisling/, aged 10 months,if(isequal([numbers],061119,4),Aisling/, aged 11 months,if(isequal([numbers],061219,4),Aisling/, aged 1 year,if(isequal([numbers],070119,4),Aisling/, aged 13 months,if(isequal([numbers],070219,4),Aisling/, aged 14 months,if(isequal([numbers],070319,4),Aisling/, aged 15 months,if(isequal([numbers],070419,4),Aisling/, aged 16 months,if(isequal([numbers],070519,4),Aisling/, aged 17 months,if(isequal([numbers],070619,4),Aisling/, aged 18 months,if(isequal([numbers],070719,4),Aisling/, aged 19 months,if(isequal([numbers],070819,4),Aisling/, aged 20 months,if(isequal([numbers],070919,4),Aisling/, aged 21 months,if(isequal([numbers],071019,4),Aisling/, aged 22 months,if(isequal([numbers],071119,4),Aisling/, aged 23 months,if(isequal([numbers],081119,4),Aisling/, aged 2 years,if(isequal([numbers],091119,4),Aisling/, aged 3 years,if(isequal([numbers],101119,4),Aisling/, aged 4 years,if(isequal([numbers],111119,4),Aisling/, aged 5 years,FIX THE CAPTION))))))))))))))))))))))))))))))))))))))))))))))/) formatdate([date,0],dd MMMM yyyy),formatdate([date,0],dd MMMM yyyy)/)

regards,
-marko.

RobOK

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 615
  • long time MC user for PC, iPod and Tivo
Re: Image Caption challenge (Marko?)
« Reply #16 on: August 11, 2006, 03:23:59 pm »

WOW!!

Demonstates the power of MC expressions when used in the hands of a Master!

You win the prize!  Once I figure out what the prize is, I'll email it to you!


I don't have the People tag filled in universally -- have started and stopped with using People tag.  A lot of tagging work, when that is rarely how I view or want to see pictures.  But I think I can work around that part another way.

I like how you put in the birthdays -- very cool!
Logged

RobOK

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 615
  • long time MC user for PC, iPod and Tivo
Re: Image Caption challenge (Marko?)
« Reply #17 on: August 11, 2006, 05:10:47 pm »

SUCCESS!!!

Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Image Caption challenge (Marko?)
« Reply #18 on: August 11, 2006, 05:55:37 pm »

Great stuff!! Class pictures too.

* marko stretches over the pond and shakes RobOK's hand!

The wife happy?

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Image Caption challenge (Marko?)
« Reply #19 on: February 10, 2009, 02:19:42 am »

Vada will be five years old soon, requiring that I extend my version of this expression.... reminded me of this thread.

How's you and yours keeping?

RobOK

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 615
  • long time MC user for PC, iPod and Tivo
Re: Image Caption challenge (Marko?)
« Reply #20 on: February 10, 2009, 08:25:37 pm »

Family is great, my daughter is 3 going on 12.  I'm sad to say, my Media Center time is few and far between.  Several things have lead to the decay:

* i have an iphone which doesn't play so nice, so I use iTunes on my laptop
* I do all my photo stuff in Lightroom
* I have a Squeezebox which I cannot get to reliably connect to MC
* we use Tivos and at inopportune times i get a glitch

To be fair to MC, my media library is served from a Buffalo drive and my MC computer is wireless, so I guess the music is making a couple wireless hops.  There is Cat5 wiring in the house, but i dont have the time or expertise to turn some of those wireless hops to wired.

Here are some recent pictures, posted with Lightroom galleries:
http://www.robertokeefe.com/images/smithfield/

thanks for the note!

Rob.
Logged
Pages: [1]   Go Up