sys_inline_variant does not map images in publishing

I am trying to create some sys_inline_template items, a simple example is below. In brief, I want to create a div with a class name and an image within the div. THe content type this is associated with is ciImage, and ciImage also has a working binary snippet, ciBnImage. ( I can use sys_inline_image successfully, where “allowed content type” is ciImage, and “allowed template” is ciBnImage. )

On publish, the image path renders successfully to folder structure.

Now, when I try to create a sys_inline_template item containing an image, the image path does not render to a folder structure on publish.

Is that possible? I’d like to be able to create a few simple sys_inline_templates for positioning and for auto-adding caption, etc.

ciImage is a simple working binary content type. The snippet I am trying to use is below.

<!DOCTYPE html>

<html>
  <head>

 	<meta content="Percussion Rhythmyx" name="generator"/>
	<link rel="stylesheet" href="${rxs_navbase}/~style/resetcss.css" type="text/css" />
    <link rel="stylesheet" href="${rxs_navbase}/~style/sitewide.css" type="text/css" />
 </head>
  <body>
    #set($img_alt = $sys.item.getProperty("image1_alt").String)
    #set($img1_height = $sys.item.getProperty("image1_height").String)
    #set($img1_width = $sys.item.getProperty("image1_width").String)
    #set($dq = '"') ## "
    #if ( $img1_height && $img1_height != "")
    #set($img_h_att = " height=${dq}${img1_height}${dq}")
    #end
    #if ( $img1_width && $img1_width != "")
    #set($img_w_att = " width=${dq}${img1_width}${dq}")
	#end
	#set($title_att = " ")
	#if($sys.item.getDefinition().getDefaultPrimaryType().getAllJSR170Properties().contains('rx:popup_caption'))
		#set($caption = $sys.item.getProperty("popup_caption").String)
		#set($title_att = " title = '$caption'")
	#end
	#set($thisclass = $sys.item.getProperty("rx:sys_title").String.replaceAll(" ","_"))##
##	

<div>## the inline variant must have some containing block - will go away
	<div class="floatright $thisclass">## 
##	
	<img src="$link" alt="$img_alt" $title_att $!img_h_att $!img_w_att /></a>
##
</div>
</div>
##   
  </body>
</html>

Where is $link being set? Is it a binding in the template, if so what is the binding set to?