Andy Jarrett // Code. Develop. Create.

Turn BlogCFC into a photo blog

If you are looking for a free coldfusion photo blog for someone you can create one quite easily with Rays BlogCFC now that enclosures have been added (thanks Ray). If you're expecting some wow coding here stop reading :o)Around line 140 (of the latest release), or basically at the top of the div='body' add the following
<cfif len(enclosure) AND reFind("gif|jpg", listLast(getFileFromPath(enclosure)))>
<p><img src="enclosures/#urlEncodedFormat(getFileFromPath(enclosure))#" /></p>
</cfif>

This has been updated to the following. I've updated the listLast function to use the "." as a deliminator
<cfif len(enclosure) AND reFind("gif|jpg", listLast(getFileFromPath(enclosure), "."))>
\n <p><img src="enclosures/#urlEncodedFormat(getFileFromPath(enclosure))#" /></p>
\n</cfif>
This checks the enclosures extention and if a .gif or .jpg then displays it. Thats it. You can see it in action for a blog i'm in the middle of updating for a friend at iPicture.it/mike.Obviously there are some other bits you might want to do:
  • On the upload resize the image
  • Create thumbnails
Enjoy

I’m here, learning and working away. If you liked this content and want to keep me going, consider buying me a coffee. Your support keeps this site running and the coffee brewing! ☕️