Get filename from path
Ever want to extract the filename from a path? C:\Inetpub\wwwroot\website\app\config\template\abc.jpg
… And not want to code something stupidly insane.
Try using #GetFileFromPath(“C:\Inetpub\wwwroot\website\app\config\template\abc.jpg”)#
So…
<cfset source=” C:\Inetpub\wwwroot\website\app\config\template\abc.jpg” />
<cfset fileName = GetFileFromPath(source) />
If your variable is a URL, you can’t use GetFileFromPath (because it needs relative paths on your computer/network) – try using #ListAtLast(“http://www.example.com/example.jpg”,”/”)#
Once again…
<cfset source=” http://www.example.com/example.jpg” />
<cfset fileName = ListAtLast(source,”/”) />… Continue reading
Downloading an image from database
So assuming you have a table called Assets, and all the right fields. There’s two options, using cfhttp or cfimage (cf8+).
Adding a watermark to original images on the fly
Found this great piece of code that will allow you to prevent users or atleast stop them a little… from downloading your images. Using the cfimage tag!
Simply use cfimage to call you’re first two images, then using ImagePaste() to mash them together, and write to the browser calling ‘#image#’.
See how you go.
<cfimage… Continue reading
