media_handle_sideload does not seem to be generating different size images.
-
I have the following code which uploads an image from a url and attaches it to a custom post type in a plugin I am developing. (edit: This code is located in my update_post function.) The image is being uploaded and attached to the post. However I am not seeing the different size images that I believe are supposed to be generated. I have looked into the upload folder and only the original image is there.
Am I doing something wrong or am I misunderstanding how this is supposed to work?
Code:
$tmp = download_url( $image_url ); $file_array = array( 'name' => $_POST['preview_filename'], 'tmp_name' => $tmp, ); // Check for download errors if ( is_wp_error( $tmp ) ) { @unlink( $file_array[ 'tmp_name' ] ); } else{ $id = media_handle_sideload( $file_array, $post->ID ); // Check for handle sideload errors. if ( is_wp_error( $id ) ) { @unlink( $file_array['tmp_name'] ); } else { update_post_meta($post->ID,'rfttc_attached_image_id', $id); update_post_meta($post->ID, 'rfttc_preview_filename', basename ( get_attached_file( $id ) ) ); } }
- The topic ‘media_handle_sideload does not seem to be generating different size images.’ is closed to new replies.