Writing image value to field_collection object I'm creating a field collection item  and saving it via entity_create, and it all works great as long as I don't have an image tied to it. As soon as I do, I get an error, and it looks like this in the watchdog table: 

    a:6:{s:5:"%type";s:12:"PDOException";s:8:"!message";s:516:"SQLSTATE[23000]: Integrity constraint violation: 1048 Column &amp;#039;fid&amp;#039; cannot be null: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array
(
    [:db_insert_placeholder_0] =&amp;gt; 
    [:db_insert_placeholder_1] =&amp;gt; file
    [:db_insert_placeholder_2] =&amp;gt; field_collection_item
    [:db_insert_placeholder_3] =&amp;gt; 50
    [:db_insert_placeholder_4] =&amp;gt; 1
)
";s:9:"%function";s:16:"file_usage_add()";s:5:"%file";s:43:"C:\xampp\htdocs\mysite\includes\file.inc";s:5:"%line";i:663;s:14:"severity_level";i:3;}


My code looks like this:

$values = array(
    'field_name' =&gt; 'field_bp_images',
    'field_bp_image_title' =&gt; array( LANGUAGE_NONE =&gt; array(array('value' =&gt; $title)), ),
    'field_bp_image_file' =&gt; array( LANGUAGE_NONE =&gt; array(array('value' =&gt; $fid)), ), 
    'field_bp_image_photographer_name' =&gt; array( LANGUAGE_NONE =&gt; array(array('value' =&gt; $photographer)), ),
    'field_bp_image_photo_flag' =&gt; array( LANGUAGE_NONE =&gt; array(array('value' =&gt; $is_photo)), ), 
  );
}

$field_collection_item  = entity_create('field_collection_item', $values);
#Attach to the node
$field_collection_item-&gt;setHostEntity('node', $node); 

// # Save field-collection item.
$field_collection_item-&gt;save(); 


My $fid is definitely populated, but I am still getting that error telling me my fid cannot be null. I'm guessing I need to provide more elements to the array, but not sure what keys to give, or how many. Any thoughts?
The column name for an image field is fid (not value), so you just need to change this bit of your $values array:

'field_bp_image_file' =&gt; array( LANGUAGE_NONE =&gt; array(array('fid' =&gt; $fid)), ),