| 2824 | | wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); |
| | 2824 | $metadata = wp_generate_attachment_metadata( $id, $upload['file'] ); |
| | 2825 | wp_update_attachment_metadata( $id, $metadata ); |
| | 2826 | |
| | 2827 | |
| | 2828 | //setup the data to be returned |
| | 2829 | $returneddata = array( 'file' => $name, |
| | 2830 | 'url' => $upload[ 'url' ], |
| | 2831 | 'type' => $type ); |
| 2826 | | return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ) ); |
| | 2833 | //Get the URLs for each image we generated |
| | 2834 | if( isset($metadata['sizes']) |
| | 2835 | && is_array($metadata['sizes']) ) { |
| | 2836 | foreach( $metadata['sizes'] as $size => $size_data ) { |
| | 2837 | if( isset($size_data['file']) ) { |
| | 2838 | $resized_url = str_replace( $name, |
| | 2839 | $size_data['file'], |
| | 2840 | $upload[ 'url' ]) ; |
| | 2841 | $returneddata[ $size.'_url' ] = $resized_url; |
| | 2842 | } |
| | 2843 | } |
| | 2844 | } |
| | 2845 | return apply_filters( 'wp_handle_upload', $returneddata ); |