$fields['thumbnail'] = array('size' => 60,
'after_html'=> "
<input type='button' value='Browse Server or Upload' onclick='BrowseServer(__fuel_field__news_2--thumbnail, value);' >
");
$fields['sm_image'] = array(
'type' => 'custom',
'class' => '',
'func' => 'ckf_single_img',
'ckfinder' => 'sm_image'
);
function ckf_single_img($params)
{
$CI =& get_instance();
$CI->load->library('form_builder');
# Display for image
$output[] = img(array(
'src' => $params['value'],
'width' => 80,
'style' => 'float:left',
'class' => $params['ckfinder'])
);
# Button
$output[] = $CI->form->button('Open Assets', '', array('ckfinder' => $params['ckfinder'], 'class' => 'open-repo ckf-edit-image'));
return join($output);
}
<img src="http://fnpsdev.org/" width="80" style="float: left; " class="thumbnail" alt=""/>
<input type="button" name="" id="" value="Open Assets" ckfinder="thumbnail" class="open-repo ckf-edit-image"/>
function set_image(fileUrl, data)
{
$("#"+data["selectActionData"]).val(fileUrl); // Hidden input
$("."+data["selectActionData"]).attr('src', fileUrl); // Preview img
}
fuel.controller.BaseFuelController = jqx.lib.BaseController.extend({
// Editing and image field, launches CKFinder
$('.ckf-edit-image').live('click',function(){
CKFinder.popup({selectActionFunction:set_image,selectActionData:$(this).attr('ckfinder')});
});
'page_image' => array(
'type' => 'custom',
'func' =>'ckf_single_img',
'ckfinder'=>'vars--page_image', # Note the 'vars--' appened to the field name for layout variables!
'description' => 'Upload image: 250px X 250px'
)
It looks like you're new here. If you want to get involved, click one of these buttons!