WordPress.org

Support

Support » How-To and Troubleshooting » wp_insert_attachment returns thumbs with resolution 1px

wp_insert_attachment returns thumbs with resolution 1px

  • Hi,
    in my plugin I use function wp_insert_attachment. I use it in a standard way like here Those Thumbnails in Media Library which I added this way shows only with resolution 1 px, other thumbnails here shows normally. When I try to edit some of them by view post in Media library I see normal picture. I don’t know what I made wrong. I am sure it workded previously well (probably before update to newer version?). Now I have version 3.8.1 and I tried it on 3 different servers with this version.
    My code is:

    $attachment = array(
        'post_mime_type' => 'image/jpeg',
        'post_title' => 'pic',
        'post_content' =>'',
        'post_status' => 'publish'
    );
    $attach_id = wp_insert_attachment( $attachment,$upload_im);
    set_post_thumbnail(get_the_ID(),$attach_id);

    Any idea to works it?

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘wp_insert_attachment returns thumbs with resolution 1px’ is closed to new replies.