Earlier today I blogged a Friday Challenge that involved taking the 12 Days of Christmas as a query and generating the song. After I posted this, I had an odd thought - why not see what the Internet (in this case, Yahoo), would do with the gifts.
I used my CFYahoo package to create a connection to their image service:
<cfset imageAPI = createObject("component", "org.camden.yahoo.image")>
Next I created my array and started to loop:
<cfset gifts = ["A partridge in a pear tree","Two turtle doves","Three French hens","Four calling birds","Five golden rings","Six geese a-laying", "Seven swans a-swimming","Eight maids a-milking","Nine ladies dancing","Ten lords a-leaping","Eleven pipers piping","Twelve drummers drumming"]>
<cfloop index="x" from="1" to="#arrayLen(gifts)#">
Then for each item I performed a search. Yahoo filters adult images by default so I didn't have to worry about that:
<cfinvoke component="#imageAPI#" method="search" returnVariable="result"> <cfinvokeargument name="query" value="#gifts[x]#"> <cfinvokeargument name="results" value="1"> </cfinvoke>
Lastly I displayed the result from each search. I did a quick view source/ctrl+a/ctrl+v and below is the results.
Yes, this is a complete and utter waste of time. Enjoy.
Edited: I added my CFM as a zip to this page. I also changed the code to show 3, as it gets interesting with multiple results. For this to work you will need my CFYahoo package and an API key.
Image search for A partridge in a pear tree
Summary: Links: | Site Index |
Image search for Two turtle doves
Summary: Two Turtle Doves
Image search for Three French hens
Three French Hens.jpgURL: http://www.dcist.com/attachments/dcist_melissa/Three%20French%20Hens.jpg
Summary: Washington Wish List: Holiday Hankerings of D.C. Foodies Whether it's Corduroy's scallops with mushroom and potato puree, 2 Amys' cod fritters, or Restaurant Eve's mojitos, DCist indulges in good food and drink about town over the holiday season
Image search for Four calling birds
Summary: On the fourth day of Christmas my true love gave to me Four calling birds Three french hens
Image search for Five golden rings
Summary: Five Golden Rings - First five books of the Old Testament. The greatest books to the Jews, worth more than gold.
Image search for Six geese a-laying
Summary: VI, The 12 Days Of Dickens' Six Geese A-Laying Set Of 2 - Introduced in 1995 - Retired in 1999 - 2.5, 1.25'' tall.Retail Price: $29.95
Image search for Seven swans a-swimming
Image search for Eight maids a-milking
Summary: Eight Maids a Milking
Image search for Nine ladies dancing
Summary: Two Turtle Doves And a Partridge in a Pear Tree. On the ninth day of Christmas, My true love gave to me,
Image search for Ten lords a-leaping
1993 Ten Lords A-Leaping.JPGURL: http://www.thepartyshop.com/Commerce/images/1993%20Ten%20Lords%20A-Leaping.JPG
Summary: 1993 Springtime Bonn.. 27-Apr-2005 21:40 57K 1993 TURTLE.jpg 14-Jul-2005 08:37 33K 1993 Ten Lords A-Lea.. 26-May-2005 14:53 28K 1993 Time for Easter.. 27-Apr-2005 21:54 100K
Image search for Eleven pipers piping
Summary: Eleven Pipers Piping ~ C o l l e c t o r s E d i t i o n ~
Image search for Twelve drummers drumming
Summary: On the twelfth day of Christmas My true love gave to me Twelve drummers drumming Eleven pipers piping,