title: Adding images to product gallery -- Can't get media type to stick
body: <p>I'm trying to add base, small, and thumbnail images to all of my products programmatically. The images are importing fine and being placed into <code>/media/catalog/product</code> as expected, but only 'Base Image' is selected when I view the product's images in the Magento backend.</p>
  
  <p>I'm looping through each product in the catalog and running:</p>
  
  <pre><code>$mediaArray = array('thumbnail', 'small_image', 'image');   
  $file = Mage::getBaseDir('media') . DS . 'import' .  trim($imageName);
  try {
      $product-&gt;addImageToMediaGallery($file, $mediaArray, false, false);
      $product-&gt;save();
  } catch (Exception $e) {
      echo $e-&gt;getMessage();
  }
  </code></pre>
  
  <p>All of my image names start with a slash, and the images themselves are uploaded to <code>/media/import</code>. I'm attempting to mimic what the Mage product importer would do.</p>
  
  <p>Any insight on why the small and thumbnail flags aren't being set would be greatly appreciated!</p>