Custom callback to select files with elfinder and codeigniter
===

I have an cms that uses codeigniter framework, elfinder to manage files etc.
I have elfinder setup with ckeditor working perfectly.
This cms behaves a bit like concrete5 as its front end editing works via adding blocks to a specific area in a page.
I am creating an image block (module) and I would like to know how can I acheive the following:
Open elfinder in modal(done)
double click in image and close modal automaticly
pass image url to a target in the new image block dialog, so I can save it to db.
Many thanks.