__('From Computer'), // handler function name => tab text ); return apply_filters('image_upload_tabs', $_default_tabs); } function image_upload_form( $action_url, $values = array(), $error = null ) { $action_url = attribute_escape( $action_url ); $image_alt = attribute_escape( @$values['image-alt'] ); $image_url = attribute_escape( @$values['image-url'] ); $image_title = attribute_escape( @$values['image-title'] ); $image_align = @$values['image-url']; ?>

Add Image

get_error_message(); ?>

/> /> /> />

'; if ( $url ) $html = ''.$html.''; media_send_to_editor($html); } function media_send_to_editor($html) { ?> 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; wp_redirect( get_option('siteurl') . "/wp-admin/upload.php?style=$style&tab=browse&action=view&ID=$id&post_id=$post_id"); } // wrap iframe content (produced by $content_func) in a doctype, html head/body etc // any additional function args will be passed to content_func function wp_iframe($content_func /* ... */) { ?> > <?php bloginfo('name') ?> › <?php _e('Uploads'); ?> — WordPress EOF; echo $out; } add_action( 'media_buttons', 'media_buttons' ); function media_buttons_head() { $siteurl = get_option('siteurl'); echo "\n"; } add_action( 'admin_print_scripts', 'media_buttons_head' ); function media_admin_css() { wp_admin_css('css/media'); } add_action('media_upload_image', 'image_upload_handler'); add_action('admin_head_image_upload_form', 'media_admin_css'); ?>