I'm attempting to generate a thumbnail for an image I have posted, but it seems when I call image_downsize, the index actually prints an array as the URL. I'm a bit confused, so any help would be appreciated!
$wpUploadPath = wp_upload_dir(); $target_path = $wpUploadPath; $filename = 'http://www.mysite.org/uploads/sampleFile.jpeg'; $fileNameFinal = pathinfo($filename); $wp_filetype = wp_check_filetype($filename, null); $attachment = array( 'post_mime_type' => $wp_filetype['type'], 'post_title' => $fileNameFinal['filename'], 'post_content' => '', 'post_status' => 'inherit' ); $attach_id = wp_insert_attachment( $attachment, $target_path); $upFile = image_downsize( $attach_id, 'thumbnail' );
Here is where I encounter the problem. If I
print_r($upFile); I get:
Array (  => http://www.mysite.org/uploads/Array  => 0  => 0  => )
Is this normal? I can't seem to generate the thumbnail to update my user meta's with this.
Any help would be appreciated. Thanks!