changing the default picture size link url

You can use:

<?php $image_attributes = wp_get_attachment_image_src( $attachment_id, array(1024,1024) ); ?>
<a href="https://wordpress.stackexchange.com/questions/37124/<?php echo $image_attributes[0]; ?>">xxx</a>

See http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src

If the picture is too small the original will show, otherwise cropped version (1024×1024).


Update: Didn’t understand your question correct. Here is what you need:

First of all add a thumbnail size for your custom max size (true is hard crop, false is soft proportional crop)

add_image_size( 'custom_size', 1024, 1024, true );

Then add this also in your functions.php:

function custom_image_media_send_to_editor($html, $attachment_id, $attachment) {
    $attachment_ = wp_get_attachment_image_src( $attachment_id, 'custom_size' );
    $attachment['url'] = $attachment_[0];

    $post =& get_post($attachment_id);
    if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
        $url = $attachment['url'];
        $align = !empty($attachment['align']) ? $attachment['align'] : 'none';
        $size = !empty($attachment['image-size']) ? $attachment['image-size'] : 'medium';
        $alt = !empty($attachment['image_alt']) ? $attachment['image_alt'] : '';
        $rel = ( $url == get_attachment_link($attachment_id) );

        return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size, $alt);
    }

    return $html;
}
add_filter('media_send_to_editor', 'custom_image_media_send_to_editor', 11, 3);

Then the next image you will add in your posts get an URL to the cropped version if the image is larger, or the full version is the image is smaller.