Add control in image detail panel

I am trying to add a checkbox control in the image details popup (when editing image in a post). I have added the following code in my template function.php but I can’t manage to display the checkbox in the popup. What am I missing?

function bluesolutions_customize_register($wp_customize) {
  $wp_customize->add_section('bluesolutions_use_lighbox_section', array(
      'title' => __('Lightbox', 'mytheme'),
      'description' => '',
      'priority' => 120,
  ));

  $wp_customize->add_setting('mytheme_use_lighbox_setting', array(
      'default' => 0,
      'capability' => '',
      'type' => 'checkbox',
  ));

  $wp_customize->add_control(new WP_Customize_Image_Control(
          $wp_customize, 'use_lighbox', array(
      'label' => __('Usen lightbox', 'mytheme'),
      'section' => 'advanced',
      'settings' => 'mytheme_use_lighbox_setting',
      'priority' => 1,
      'type' => 'checkbox',
          )
  ));
}

add_action( 'customize_register', 'bluesolutions_customize_register' );

enter image description here

Solutions Collecting From Web of "Add control in image detail panel"

You can use this code

function your_slug_edit_media_custom_checkbox( $form_fields, $post ) {
    $form_fields['custom_field'] = array(
        'label' => 'Custom Field',
        'input' => 'text',
        'value' => get_post_meta( $post->ID, '_custom_field', true )
    );
    return $form_fields;
}
function your_slug_save_media_custom_field( $post, $attachment ) {
    update_post_meta( $post['ID'], '_custom_field', $attachment['custom_field'] );
    return $post;
}
add_filter( 'attachment_fields_to_edit', 'edit_media_custom_checkbox', 11, 2 );
add_filter( 'attachment_fields_to_save', 'save_media_custom_checkbox', 11, 2 );