Changeset 6726 for trunk/wp-admin/includes/media.php
- Timestamp:
- 02/05/2008 06:47:27 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/media.php
r6659 r6726 16 16 $image_align = @$values['image-url']; 17 17 $post_id = $_GET['post_id']; 18 18 19 19 ?> 20 20 <div id="media-upload-header"> … … 34 34 <!-- 35 35 36 jQuery(document).ready(function(){ 36 jQuery(document).ready(function(){ 37 37 var swfu = new SWFUpload({ 38 38 upload_url : "<?php echo get_option('siteurl').'/wp-admin/async-upload.php'; ?>", … … 60 60 cancelButtonId : "btnCancel2" 61 61 }, 62 62 63 63 debug: false, 64 64 65 65 }); 66 66 … … 108 108 109 109 function image_upload_handler() { 110 110 111 111 if ( !current_user_can('upload_files') ) { 112 112 return new wp_error( 'upload_not_allowed', __('You are not allowed to upload files.') ); … … 120 120 // Add Image button was clicked 121 121 check_admin_referer('inlineuploading'); 122 122 123 123 // if the async flash uploader was used, the attachment has already been inserted and its ID is passed in post. 124 124 // otherwise this is a regular form post and we still have to handle the upload and create the attachment. … … 135 135 $id = image_upload_post(); 136 136 } 137 137 138 138 // if the input was invalid, redisplay the form with its current values 139 139 if ( is_wp_error($id) ) … … 151 151 if ( empty($thumb_url) ) 152 152 $thumb_url = wp_mime_type_icon($id); 153 153 154 154 if ($thumb_url) { 155 155 $out = '<p><input type="hidden" name="attachment_id" id="attachment_id" value="'.intval($id).'" />' … … 161 161 . basename(wp_get_attachment_url($id)).'</p>'; 162 162 } 163 163 164 164 $post = get_post($id); 165 165 $title = addslashes($post->post_title); 166 166 $alt = addslashes($post->post_content); 167 167 168 168 // populate the input fields with post data (which in turn comes from exif/iptc) 169 169 $out .= <<<EOF … … 175 175 jQuery('#image-add').attr('disabled', false); 176 176 --> 177 </script> 177 </script> 178 178 EOF; 179 179 … … 185 185 186 186 function image_send_to_editor($id, $alt, $title, $align, $url='') { 187 187 188 188 $img_src = wp_get_attachment_url($id); 189 189 $meta = wp_get_attachment_metadata($id); 190 190 191 191 $hwstring = ''; 192 192 if ( isset($meta['width'], $meta['height']) ) … … 208 208 top.tb_remove(); 209 209 --> 210 </script> 210 </script> 211 211 <?php 212 212 } … … 218 218 if ( empty($_POST['image-alt']) ) 219 219 return new wp_error( 'image_alt_required', __('Please enter an <alt> description') ); 220 220 221 221 $overrides = array('test_form'=>false); 222 222 $file = wp_handle_upload($_FILES['image-file'], $overrides); … … 224 224 if ( isset($file['error']) ) 225 225 return new wp_error( 'upload_error', $file['error'] ); 226 226 227 227 $url = $file['url']; 228 228 $type = $file['type']; 229 229 $file = $file['file']; 230 230 231 231 $post_title = trim($_POST['image-title']); 232 232 $post_content = trim($_POST['image-alt']); 233 233 $post_parent = intval($_POST['parent_post_id']); 234 234 235 235 // Construct the attachment array 236 236 $attachment = array( … … 248 248 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); 249 249 250 return $id; 250 return $id; 251 251 } 252 252
Note: See TracChangeset
for help on using the changeset viewer.