Php Magento从数据库源更新图像(直接查询?)

Php Magento从数据库源更新图像(直接查询?),php,sql,magento,Php,Sql,Magento,我在magento中有以下代码,用于转换PDF文件的第一页(donwloadable product file),并将第一页发送到特定位置 public function convertPDF(){ $_prodId = $this->getProduct()->getId(); $_proFile =$this->getLinkFile(); $product = Mage::registry('current_product');

我在magento中有以下代码,用于转换PDF文件的第一页(donwloadable product file),并将第一页发送到特定位置

  public function convertPDF(){

    $_prodId  = $this->getProduct()->getId();
    $_proFile =$this->getLinkFile();

    $product = Mage::registry('current_product');
    if ($product->getTypeId() == 'downloadable') {
        $table = Mage::getModel('downloadable/link');
        $collection = $table->getCollection()->addProductToFilter($product->getId());
        foreach ($collection as $downloadable){
            $linkFile = $downloadable->getLinkFile();
            break;
        }
        $_proFile  = $linkFile;
    }


    $path= '/files/links';
    $pathout= '/product/small/';



     exec('convert '.$path.$_proFile.'[0] '.$pathout.$_prodId.'.jpg');

    }
现在,我想把这个图像设置为小图像,我知道小图像存储在 目录\产品\实体\属性id为86的varchar


我的问题是如何更新表设置该表中函数的结果

我通过添加

  $conn  = Mage::getSingleton('core/resource')->getConnection('core_write');
$sql = "update catalog_product_entity_varchar
set value = ".$_prodId."
where entity_id = ".$_prodId."
and attribute_id  = 86 ";
$result = $conn->query($sql);