Dynamic loading of images and a "404" image

I have a screen set up so that it passes the production line in as a parameter. This parameter is then used in an image tag to create the link to the image:


1 = {view.params.Name}

I then have a transform that does the following


{view.params.dir} = /system/images/products
{value} = current SKU tag lookup
{filetype} = .png

I tried removing the expression transform and creating a script transform

def transform(self, value, quality, timestamp):
	Transform the incoming value and return a result.

		self: A reference to the component this binding is configured on.
		value: The incoming value from the binding or the previous transform.
		quality: The quality code of the incoming value.
		timestamp: The timestamp of the incoming value as a java.util.Date
	import system.file
	return system.file.fileExists(self.view.params.dir + str(value) + self.view.params.filetype)

this returns false. I also tried

return  system.file.fileExists(self.session.props.gateway.address +"/main" + self.view.params.dir + str(value) + self.view.params.filetype)

This also returns false even though I can browse to that file.

The desired end result is if the value.png doesn’t exist then I’ll return a default 404.png image instead.