| 2832 | | return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ), 'upload' ); |
| | 2834 | //setup the data to be returned |
| | 2835 | $returneddata = array( 'file' => $name, |
| | 2836 | 'url' => $upload[ 'url' ], |
| | 2837 | 'type' => $type ); |
| | 2838 | |
| | 2839 | //Get the URLs for each image we generated |
| | 2840 | if( isset($metadata['sizes']) |
| | 2841 | && is_array($metadata['sizes']) ) { |
| | 2842 | foreach( $metadata['sizes'] as $size => $size_data ) { |
| | 2843 | if( isset($size_data['file']) ) { |
| | 2844 | $resized_url = str_replace( $name, |
| | 2845 | $size_data['file'], |
| | 2846 | $upload[ 'url' ]) ; |
| | 2847 | $returneddata[ $size.'_url' ] = $resized_url; |
| | 2848 | } |
| | 2849 | } |
| | 2850 | } |
| | 2851 | return apply_filters( 'wp_handle_upload', $returneddata ); |