| 2870 | | return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ), 'upload' ); |
| | 2871 | //setup the data to be returned |
| | 2872 | $returneddata = array( 'file' => $name, |
| | 2873 | 'url' => $upload[ 'url' ], |
| | 2874 | 'type' => $type ); |
| | 2875 | |
| | 2876 | //Get the URLs for each image we generated |
| | 2877 | if( isset($metadata['sizes']) |
| | 2878 | && is_array($metadata['sizes']) ) { |
| | 2879 | |
| | 2880 | //Find the filename as stored on disk (may |
| | 2881 | //not be the same as supplied by the client) |
| | 2882 | $savedfile = basename($metadata['file']); |
| | 2883 | |
| | 2884 | //for each size, copy the url for the fullsize image... |
| | 2885 | //...replacing the filename with the appropriate string |
| | 2886 | foreach( $metadata['sizes'] as $size => $size_data ) { |
| | 2887 | if( isset($size_data['file']) ) { |
| | 2888 | $resized_url = str_replace( $savedfile, |
| | 2889 | $size_data['file'], |
| | 2890 | $upload[ 'url' ]); |
| | 2891 | $returneddata[ $size.'_url' ] = $resized_url; |
| | 2892 | } |
| | 2893 | } |
| | 2894 | } |
| | 2895 | return apply_filters( 'wp_handle_upload', $returneddata, 'upload' ); |