Duplicates with WP_Query loop

It is quite hard to properly answer your question with the amount of context in your question, but I am going to try to use the context from your previous question

Having a bit more context here on template, and if I read this correctly, this is on your index.php, I still believe and stand by my point that pre_get_posts is your answer. Tackle this problem as follow (only if this is not a static front page, because the following will not work)

  • Remove your custom query. Go back to your default setup where you get all posts normally

  • Next, use pre_get_posts to alter the main query on your homepage to only display posts with thumbnails. This should solve your issue with pagination

Add the following in your functions.php: (Requires at least PHP 5.3)

add_action( 'pre_get_posts', function ( $q ) 
{
    if (     $q->is_home() // Target the home page only
          && $q->is_main_query() // Target only the main query
    ) {
        $meta_query = array(
            array(
                'key' => '_thumbnail_id'
            )
        );
        $q->set( 'meta_query', $meta_query );
    }
});

If this does not solve your issue, then you really need to post more context.

EDIT

I’m not going to go into detail about query_posts and how bad it really really is, I have covered that in my previous answer to your previous question. As you most probably did not code that, I would contact the developer about this.

Anyway, to quick solve your issue with infinite scrolling, you need to add the following to your query_posts arguments

'meta_query' => array( array( 'key' => '_thumbnail_id' ) ),

Just a note, I would rather rewrite the complete infinite scrolling function with WP_Query as described in your previous question