How to get files from loop for zip

As the files are within the same WP installation (not a remote), you don’t need to download the file using get_file_contents(), try to add the file using its absolute path of the attachment.

if(isset($_POST['download'])){
    $tmpFile = tempnam('/tmp', '');
    $zip = new ZipArchive();
    $zip->open($tmpFile, ZipArchive::CREATE);

    
    foreach( $list_posts as $list_item ) :
      if ( $list_item->post_type == 'crb_photo' ):
        if ( has_post_thumbnail( $list_item->ID ) ) {
          $zip->addFile(get_attached_file(get_post_thumbnail_id($list_item->ID )));
        }
      }
    }

    $zip->close();

    header('Content-Type: application/zip');
    header('Content-disposition: attachment; filename=artist-photos.zip');
    header('Content-Length: ' . filesize($tmpFile));
    readfile($tmpFile);

    unlink($tmpFile);
}

Note typed the code in this editor, may contain syntax error.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)