1

This is probably something simple but I am struggling with it.

If in my application.cfc I have below

this.mappings = { "/foo" = expandPath('gfx/')

And I want to call said directory when pulling up an image

<img src="/foo/test.jpg" width="90" height="90" />

Why is it not working?

Miguel-F
  • 13,450
  • 6
  • 38
  • 63
  • As miguel said - you don't need a coldFusion mapping - you need a virtual directory in IIS Or apache. src="/blah" does not trigger cf in any way. It's pushed to the browser where it is subsequently called through HTTP & IIS. Since the file is .JPG it will be served as an image. CF not in play. – Mark A Kruger Aug 30 '17 at 19:52

1 Answers1

5

ColdFusion mappings only apply to ColdFusion code. Tags like cfinclude, cfmodule, or for calling CFCs, etc. What you are attempting to use it for is an HTML img src attribute which expects an absolute or relative URL. If you want similar functionality look into creating a virtual directory on your web server.

Of course there are many other things ColdFusion will allow you to do in building that URL or pushing an image to the browser but I think that answers your specific question here.

Miguel-F
  • 13,450
  • 6
  • 38
  • 63