How can I save multiple images to one image field programtically? I have an image field that I am trying to save multiple images to.  There is one field but when I set up the array, only the first image fid is saved.

$i = 0;
foreach ($photos as $photo) {
// make sure we actually retrived this particular image
if ($photo['Success'] == TRUE) {
    // setup the filename and filepath, then write the file to disk
    $filename = "{$id}-{$number}.jpg";
    $filepath = "public://drealty_img/{$filename}";

    // Create image object
    $file = file_save_data($photo['Data'], $filepath, FILE_EXISTS_REPLACE);

    // add this image to the content entity
    $content-&gt;images = array(
        'und' =&gt; array(
            $i =&gt; array(
                'fid' =&gt; $file-&gt;fid,
            ),
        ),
    );
} // endif $photo['Sucess']
$i++;
} // endfor $photos


Am I saving the image field incorrectly?  Or is there something that needs to be set up to allow for multiple images to be saved?
I changed the following code:

 $content-&gt;images = array(
        'und' =&gt; array(
            $i =&gt; array(
                'fid' =&gt; $file-&gt;fid,
            ),
        ),
    );


to

$content-&gt;images['und'][$i] = array(
  'fid' =&gt; $file-&gt;fid,
);


And it worked