This page redirects to an external site: https://developer.wordpress.org/reference/
An example function based on this filter hook that regulates the size of the images, based on you having phpThumb. (http://phpthumb.sourceforge.net - phpThumb is a free library you can download and install on your php webserver. Installation and configuring phpThumb is beyond scope of this, sorry).
add_filter('pre_link_image','pre_link_image_add_thumb');
function pre_link_image_add_thumb($img_url){
// set our width value
$width = 400;
// set a height value? update it in the params line below add "&h=$height". we only are using width though.
// $height = 80;
// this points to our specific location for phpThumb
$thumb_file = "http://yourserver.com/phpThumb/phpThumb.php";
// here we specify a width and the img src recvd by this function
$thumb_params = "w=$width&src=$img_url";
// and now we make our "new" img url
$new_img_url = $thumb_file . "?" . $thumb_params;
// and now we return it!
return $new_img_url;
}
Basically, you can do stuff with/to the img_url entered by the user when they add/edit a link. this info is then written to the database, and now is what the user sees when going back to edit that link. The other end of this would be a "post_link_image" function, but i don't believe the hooks exist yet on that side.
Return to Plugin API/Filter Reference