# Option: insertimage_callback

This option enables you to override the build in functionality for inserting images. This option should contain a function name to be executed when a new image is inserted into TinyMCE. The format of this callback function is: insertImage(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action). Where most of these options are self explained the action can be "update" or "insert" depending on what operation type. This function should return an array with the same values as the incomming parameters, the example below describes how this is done. This option is set to a internal TinyMCE function by default.

### Example of usage of the insertimage_callback option:

    function myCustomInsertImage(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action) {
    	var result = new Array();

    	// Do some custom logic
    	result['src'] = "logo.jpg";
    	result['alt'] = "test description";
    	result['border'] = "2";
    	result['hspace'] = "5";
    	result['vspace'] = "5";
    	result['width'] = width;
    	result['height'] = height;
    	result['align'] = "right";
    	result['title'] = "Some title";
    	result['onmouseover'] = "";
    	result['onmouseout'] = "";

    	return data;
    }

    tinyMCE.init({
    	...
    	insertimage_callback : "myCustomInsertImage"
    });