diff --git a/wp-admin/css/media.css b/wp-admin/css/media.css
index 62860a766..fb86e84bb 100644
--- a/wp-admin/css/media.css
+++ b/wp-admin/css/media.css
@@ -109,11 +109,17 @@ form.media-upload-form {
background: url(../images/align-right.png) no-repeat center left;
}
-.media-upload-form fieldset#image-size label {
+#flash-upload-ui, .insert-gallery {
+ display: none;
+}
+
+tr.image-size label {
display: inline;
margin: 0 1em 0 0;
}
-
+tr.image-size td.field {
+ text-align: center;
+}
.pinkynail {
max-width: 40px;
max-height: 40px;
@@ -187,11 +193,11 @@ span.filename {
.describe input[type="text"], .describe textarea {
width: 460px;
}
-.describe a.delete {
+a.delete {
display: block;
text-align: center;
- line-height: 24px;
width: 100%;
+ color: #246;
}
.describe-toggle-on, .describe-toggle-off {
line-height: 36px;
diff --git a/wp-admin/edit-attachment-rows.php b/wp-admin/edit-attachment-rows.php
index b8ae190bb..ca3ab3887 100644
--- a/wp-admin/edit-attachment-rows.php
+++ b/wp-admin/edit-attachment-rows.php
@@ -46,16 +46,17 @@ foreach($posts_columns as $column_name=>$column_display_name) {
case 'media':
?>
-
+
+ guid)); ?>
+ ID); ?>
+
-
+ post_excerpt : ''; ?>
$column_display_name) {
?>
-
+
-
-
-get_error_message();
-} ?>
-
-
-
- $id,
- 'post_title' => $_POST['image-title'],
- 'post_content' => $_POST['image-alt'],
- ));
- }
- else {
- $id = image_upload_post();
- }
-
- // if the input was invalid, redisplay the form with its current values
- if ( is_wp_error($id) )
- wp_iframe( 'image_upload_form', get_option('siteurl') . '/wp-admin/media-upload.php?type=image', $_POST, $id );
- else {
- media_send_to_editor(get_image_send_to_editor($id, $_POST['image-alt'], $_POST['image-title'], $_POST['image-align'], $_POST['image-url'], true, $_POST['image-size']));
- }
- }
-}
-
-// this returns html to include in the single image upload form when the async flash upload has finished
-// i.e. show a thumb of the image, and include the attachment id as a hidden input
-function async_image_callback($id) {
- $thumb_url = wp_get_attachment_thumb_url($id);
- if ( empty($thumb_url) )
- $thumb_url = wp_mime_type_icon($id);
-
- if ($thumb_url) {
- $out = ' '
- . ' '
- . basename(wp_get_attachment_url($id)).'
';
- }
- else {
- $out = ' '
- . basename(wp_get_attachment_url($id)).'
';
- }
-
- $post = get_post($id);
- $title = addslashes($post->post_title);
- $alt = addslashes($post->post_content);
-
- // populate the input fields with post data (which in turn comes from exif/iptc)
- $out .= <<
-
-
-EOF;
-
- return $out;
-}
-
-add_filter('async_upload_image', 'async_image_callback');
-
-
function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = false, $size='medium') {
$html = get_image_tag($id, $alt, $title, $align, $rel, $size);
@@ -254,45 +62,6 @@ top.tb_remove();
exit;
}
-// this handles the file upload POST itself, validating input and inserting the file if it's valid
-function image_upload_post() {
- if ( empty($_FILES['image-file']['name']) )
- return new wp_error( 'image_file_required', __('Please choose an image file to upload') );
- if ( empty($_POST['image-alt']) )
- return new wp_error( 'image_alt_required', __('Please enter an <alt> description') );
-
- $overrides = array('test_form'=>false);
- $file = wp_handle_upload($_FILES['image-file'], $overrides);
-
- if ( isset($file['error']) )
- return new wp_error( 'upload_error', $file['error'] );
-
- $url = $file['url'];
- $type = $file['type'];
- $file = $file['file'];
-
- $post_title = trim($_POST['image-title']);
- $post_content = trim($_POST['image-alt']);
- $post_parent = intval($_POST['parent_post_id']);
-
- // Construct the attachment array
- $attachment = array(
- 'post_title' => $post_title,
- 'post_content' => $post_content,
- 'post_type' => 'attachment',
- 'post_parent' => $post_parent,
- 'post_mime_type' => $type,
- 'guid' => $url
- );
-
- // Save the data
- $id = wp_insert_attachment($attachment, $file, $post_parent);
- if ( !is_wp_error($id) )
- wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
-
- return $id;
-}
-
// this handles the file upload POST itself, creating the attachment post
function media_handle_upload($file_id, $post_id, $post_data = array()) {
$overrides = array('test_form'=>false);
@@ -371,24 +140,12 @@ if ( is_string($content_func) )
-
-
-
-
-
-
-EOF;
- echo $out;
+ echo "" . __('Add media'). ' ';
}
add_action( 'media_buttons', 'media_buttons' );
@@ -522,11 +279,12 @@ function get_attachment_taxonomies($attachment) {
function image_attachment_fields_to_edit($form_fields, $post) {
if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
$form_fields['post_title']['required'] = true;
- $form_fields['post_excerpt']['label'] = __('Alternate Text');
- $form_fields['post_content']['label'] = __('Description');
+ $form_fields['post_excerpt']['label'] = __('Description');
+ $form_fields['post_excerpt']['helps'][] = __('Alternate text, e.g. "The Mona Lisa"');
- if ( strlen(trim($post->post_excerpt)) == 0 )
- $form_fields['post_excerpt']['helps'][] = __('Alternate Text helps people who can not see the image.');
+ $form_fields['post_content']['label'] = __('Long Description');
+
+ $thumb = wp_get_attachment_thumb_url();
$form_fields['_send']['url'] = array(
'label' => __('Link URL'),
@@ -547,6 +305,17 @@ function image_attachment_fields_to_edit($form_fields, $post) {
" . __('Right') . " \n",
);
+ $form_fields['_send']['image-size'] = array(
+ 'label' => __('Size'),
+ 'input' => 'html',
+ 'html' => "
+ " . ( $thumb ? "
+ " . __('Thumbnail') . "
+ " : '' ) . "
+ " . __('Medium') . "
+
+ " . __('Full size') . " ",
+ );
}
return $form_fields;
}
@@ -581,7 +350,12 @@ function image_media_send_to_editor($html, $attachment_id, $attachment) {
else
$align = 'none';
- return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel);
+ if ( !empty($attachment['image-size']) )
+ $size = $attachment['image-size'];
+ else
+ $size = 'medium';
+
+ return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size);
}
return $html;
@@ -603,11 +377,11 @@ function get_attachment_fields_to_edit($post, $errors = null) {
'value' => $edit_post->post_title,
),
'post_excerpt' => array(
- 'label' => __('Excerpt'),
+ 'label' => __('Description'),
'value' => $edit_post->post_excerpt,
),
'post_content' => array(
- 'label' => __('Description'),
+ 'label' => __('Long description'),
'value' => $edit_post->post_content,
'input' => 'textarea',
'helps' => array(__('If filled, the default link URL will be the attachment permalink.')),
@@ -637,25 +411,21 @@ function get_attachment_fields_to_edit($post, $errors = null) {
// Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default
// The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing )
$form_fields = array_merge_recursive($form_fields, (array) $errors);
-
+
$form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post);
return $form_fields;
}
function get_multimedia_item( $attachment_id, $errors = null, $send = true ) {
- $thumb_url = wp_get_attachment_thumb_url( $attachment_id );
- if ( empty($thumb_url) )
- $thumb_url = wp_mime_type_icon( $attachment_id );
- if ( empty($thumb_url) && ( $post =& get_post( $attachment_id ) ) && substr($post->post_mime_type, 0, 5) == 'image' )
- $thumb_url = wp_get_attachment_url( $attachment_id );
+ $thumb_url = array_shift(get_attachment_icon_src( $attachment_id ));
$title_label = __('Title');
$description_label = __('Description');
$tags_label = __('Tags');
- $toggle_on = __('Describe');
- $toggle_off = __('Describe «');
+ $toggle_on = __('Show');
+ $toggle_off = __('Hide');
$post = get_post($attachment_id);
@@ -697,12 +467,12 @@ function get_multimedia_item( $attachment_id, $errors = null, $send = true ) {
$send = " ";
if ( empty($form_fields['save']) && empty($form_fields['_send']) ) {
- $form_fields['save'] = array('tr' => "\t\t$delete $save$send \n");
+ $form_fields['save'] = array('tr' => "\t\t$delete $save$send \n");
} elseif ( empty($form_fields['save']) ) {
$form_fields['save'] = array('tr' => "\t\t$save \n");
foreach ( $form_fields['_send'] as $id => $field )
$form_fields[$id] = $field;
- $form_fields['send'] = array('tr' => "\t\t$delete $send ");
+ $form_fields['send'] = array('tr' => "\t\t$delete $send ");
}
$hidden_fields = array();
@@ -773,13 +543,15 @@ function multimedia_upload_form( $errors = null ) {
?>
-
-
-
-
-