This filter checks if an anchor is in the html image send to the editor and if so adds rel and class to the anchor.
function add_highslide_attr( $html ) {
preg_match_all('/(<a[^>]*>)(.*)/i', $html, $result);
if( !isset($result) || !isset($result[1][0]) || ! $result[1][0] )
return $html;
$anchor = $result[1][0];
if( strstr($anchor, 'rel=") )
$anchor = str_replace("rel=""https://wordpress.stackexchange.com/questions/77460/,"rel="highslide ', $anchor);
else
$anchor = str_replace('href="https://wordpress.stackexchange.com/questions/77460/,"rel="highslide" href=", $anchor);
if( strstr($anchor, "class=") )
$anchor = str_replace("class=""https://wordpress.stackexchange.com/questions/77460/,"class="highslide ', $anchor);
else
$anchor = str_replace('href="https://wordpress.stackexchange.com/questions/77460/,"class="highslide" href=", $anchor);
$html = $anchor . $result[2][0];
return $html;
}
add_filter( "image_send_to_editor"https://wordpress.stackexchange.com/questions/77460/,"add_highslide_attr', 10 );