Naguro_Image_Upload_Request

The WooCommerce Naguro Connect Naguro Image Upload Request class.

Defined (1)

The class is defined in the following location(s).

/includes/naguro/requests/class-image-upload-request.php  
  1. class Naguro_Image_Upload_Request extends Naguro_Request { 
  2. public function output() { 
  3. foreach ( $_FILES as $key => $file ) { 
  4. if ( ! empty( $file['name'] ) && 4 != $file['error'] ) { 
  5. $id = media_handle_upload( $key, 0 ); 
  6. update_post_meta($id, '_naguro_image_session_id', absint($_POST['session'])); 
  7.  
  8. $image_src = wp_get_attachment_image_src( $id, 'full' ); 
  9.  
  10. echo json_encode( array( 
  11. 'id' => $id,  
  12. 'width' => $image_src[1],  
  13. 'height' => $image_src[2],  
  14. ) ); 
  15. die();