add parameters to Image preview (IMG tag) in the edit form

Archived from the Xataface Users forum.

neotrode — Wed Jan 11, 2012 10:40 am

What function can I use in the Delegate class to replace or revise the output of the Wrapper/Preview of an image? I want to add a class or ID parameter to the IMG tag so that Jquery interprets it.

I tried these two possibilities to no avail…

Code: Select all
`function NL_photo__renderCell( &$record ) {
   return “<img id="jcrop_image" src="http://”.$_SERVER[‘SERVER_NAME’].”/images/article/”.$record->strval(‘NL_photo’).”" width=130>”;
}

and…

function NL_photo__htmlValue(&$record){

   return “<img id="jcrop_image" src="http://”.$_SERVER[‘SERVER_NAME’].”/images/article/”.$record->strval(‘NL_photo’).”" width=130>”;
}`

Thanks,
Frank


shannah — Wed Jan 11, 2012 2:02 pm

Unfortunately these previews are currently just hard coded in the Dataface_QuickForm_element.html template (in the Dataface/templates directory).

This should really be remedied but for now you’ll need to override this template. (e.g. you could copy this into your own templates directory and make changes accordingly to make it work for you).

-Steve


neotrode — Thu Jan 12, 2012 12:04 pm

Ah…found it. Unfortunately, like you said, I have to hard code it in but at least it is in the overridden template. It is named: Dataface_Form_Section_Template.html

For those wondering why to use this… This inquiry was in reference to the following other post:
http://www.xataface.com/forum/viewtopic.php?f=4&t=6537
I also explain how I integrated the JQuery JCrop tool to an image uploaded in the table.

Best,
Frank