Filemaker ODBC/JDBC to Coldfusion
I have successfully got coldfusion talking to a Filemaker 9 database. It turned out to be pretty simple really.
I enabled ODBC/JDBC in Filemaker server. Installed the latest SequeLink on the coldfusion server. Setup a System DSN and pointed to it in the coldfusion admin. The only odd thing I ran into is in Filemaker field names can have spaces so when I do an insert into a field I have to put double quotes on the field name.
Previous and Next in Coldfusion
I have done this before when the data was clean and when I only needed to worry about one ID by just adding or subtracting one from the ID value. On my photo album pages I wanted to create a way to view my photos without lytebox. I have 2 IDs photo album and photo. Also my data is not the cleanest for example in my Denver photos I do not have a photo 1. I came up with a solution, not the most elegant I will admit. My work around for this problem includes looping the query to set the row number to a variable than instead of displaying against the photo ID I display against the row number. To create the next and previous I just add or subtract 1 from the row number. I also had to put a cfif to check to make sure my previous row variable was not -1. The code is below. You can see it in action here.
<cfif QPhotos.Photo_ID eq URL.PHOTO>
<cfset displayrow = QPhotos.currentrow>
<cfset nextrow = displayrow+1>
<cfset previousrow = displayrow-1>
<cfif previousrow GT 0><cfoutput query=“QPhotos” startrow=“#previousrow#” maxrows=“1″>
<cfoutput query=“QPhotos” startrow=“#displayrow#” maxrows=“1″>
<cfoutput query=“QPhotos” startrow=“#nextrow#” maxrows=“1″>
Using CFIMAGE to create a watermark
Continuing my week off playing around with cfimage, I am thinking this is fast becoming my favorite new feature in Coldfusion 8. This morning I was thinking it would be cool if Coldfusion could watermark images for me. After about 30mins playing around I came up with this.
<cfimage source=“img_2566.jpg” name=“image”>
<cfimage source=“watermark.png” name=“watermark”>
<cfset ImagePaste(image, watermark, 0, 0)>
<cfimage source=“#image#” action=“writeToBrowser” format=“jpg”>
First 2 lines I basically give both images a name. The reason the watermark is a png is I want to have the ability to use alpha channels. Next line I paste the watermark onto the image at 0x and 0y. I cheated and created the images the same size, but you could easily read the image info get the size then calculate where you want the watermark to be. The last line writes the image to the browser in the format of a jpeg. You can check it out in action at my CFwatermark page.
Using cfimage to create thumbnails
I have been playing around with the new cfimage tag in coldfusion 8. I am very impressed with the resize capability. Coldfusion 8 seemed to do a great job resizing my images into thumbnails. I created a tutorial here.
Here is a little bit of code to create thumbnails.
<cfimage action=“info” structname=“imagetemp” source=“Path to your image”>
<cfset x=min(150/imagetemp.width, 113/imagetemp.height)>
<cfset newwidth = x*imagetemp.width>
<cfset newheight = x*imagetemp.height>
<cfimage action=“resize” source=“#Path to your image#” width=“#newwidth#” height=“#newheight#” destination=“#thumbnail destination#”>
Blog roll for BlogCFC
I have been playing around with Ray Camden’s BlogCFC for the past few weeks. I am planning on moving over from BlogCFM. One think that I really wanted with my new blog was the ability to easily update links in my blog roll. BlogCFC did not have this out the box, but I came up with a very easy whay of doing this. Using BlogCFC’s Textblocks feature I created a textblok called “blog roll”. Next I created a pod called blogroll.cfm and called my blog roll text block using
WHERE LABEL = ‘Blog Roll’
Now all I have to do is update the links in my blog roll textblock, refresh blog cache and my blog roll is updated.
CFChart not working with Coldfusion 7.0.2
I installed Coldfusion 7.0.2 and my TSX Avg MPG chart would not display in IE. It would display fine in FireFox and Safari. After doing some searching I found a trick that worked for me, under your web root create a folder named CFIDE inside of it create a folder called Scripts. Do a search on your hard drive for cf_runactivecontent.js and copy it to the CFIDE/Scripts folder you created. It is working like a charm for me now.
Farcry CMS – Friendly URLS
I have been playing around a good bit with Farcry CMS a content management system for coldfusion. I have it up and running at http://www.ledetfamily.com (not really much up there mostly a domain that I use to play with stuff for the time being) I have now set it up successively with both mollio and the friendly url plugin under IIS 6. Mollio was pretty straight forward using the directions here. As for the friendly URL plugin it was a little more work. I started by following all the directions here, but they leave out one important point you need to install an ISAPI Rewrite plugin under IIS. I just installed this per the directions at the site here and created an IsapiRewrite4.ini file in the same directory as the plugin and added this code:
# friendly url rules
RewriteRule ^/go/(.*)$ /go.cfm?path=/go/$1 [L,PT]
That was it, seems to be working like a champ now. You can check it out at LedetFamily.com.