Wordpress画廊图片网址到数组

I'm trying to get an array of image urls on wordpress from the images added to the post gallery, I don't really know what I'm doing wrong here but I think I don't get a correct array from wordpress, can anyone help me with this?

<?php  
if(have_posts()) : while(have_posts()) : the_post();

$gallery = get_post_gallery_images(the_post()); 
$i = 0;
foreach($gallery as $image)
{
    echo('<div>');
    echo('<img u="image" src="'.$image.'" alt="'.the_title().$i.'" title="'.the_title().$i.'"/>');
    echo('<img u="thumb" src="'.$image.'" alt="'.the_title().$i.'" title="'.the_title().$i.'"/>');
    echo('</div>');
    $i++;
 }
endwhile; endif; ?>
?>

try to use the "$post->ID" instead "the_post" inside $gallery like this:

$gallery = get_post_gallery_images( $post->ID );