title: Update product image label in Magento 1.9
body: <p>I am trying to update the product image label. I wrote an observer to catch <code>catalog_product_save_before</code>.</p>
  
  <p>The observer is catching the event and I am able echo/die from the function.</p>
  
  <p>Here is the function to save the label.</p>
  
  <pre><code>    public function catalog_product_save_before($observer)
      {
  
  //        $product = $observer-&gt;getProduct();
  //        $product_id = $product-&gt;getId();
  
          $conn_write = Mage::getSingleton('core/resource')-&gt;getConnection('core_write');
          if (isset($_POST['Media'])) {
              $post = $_POST['Media'];
              foreach ($post as $value_id =&gt; $item) {
                  $sql = "UPDATE catalog_product_entity_media_gallery_value SET `label` = '" . addslashes($item['label']) . "' WHERE  value_id = " . (int)$value_id;
                  if (isset($item['position'])) {
                      $sql = "UPDATE catalog_product_entity_media_gallery_value SET `label` = '" . addslashes($item['label']) . "', `position` = " . (int)$item['position'] . " WHERE  value_id = " . (int)$value_id;
                  }
                  $conn_write-&gt;query($sql);
              }
          }
  
          return $this;
      }
  </code></pre>
  
  <p>Here is an echo of the $sql</p>
  
  <pre><code>UPDATE catalog_product_entity_media_gallery_value SET `label` = 'Test Label Text' WHERE value_id = 8441
  </code></pre>
  
  <p>When I run this in Workbench the label is updated,
  also when I run _test.php it's updated as well.?</p>
  
  <p>_test.php:
      
  
  <pre><code>require_once "app/Mage.php";
  Mage::app();
  $conn_write = Mage::getSingleton('core/resource')-&gt;getConnection('core_write');
  $item = ['label'=&gt;'123456798'];
  $value_id = 8441;
  
  $sql = "UPDATE catalog_product_entity_media_gallery_value SET `label` = '" . addslashes($item['label']) . "' WHERE  value_id = " . (int)$value_id;
  $conn_write-&gt;query($sql);
  
  die("COMPLETE");
  </code></pre>
  
  <p>Can someone shed some light as to why the row is not allowed to be updated?</p>
  
  <p>Is there a way to get some feedback from MySQL?</p>