如何在PHP中添加blob图像FIrebird?

时间:2017-08-16 11:13:05

标签: php firebird

无法向FIrebird添加照片。写这样的代码

        $imgSrc='Desert.jpg';
    $img_src = $imgSrc;
    $imgbinary = fread(fopen($img_src, "r"), filesize($img_src));
    $img_str = base64_encode($imgbinary); 

    $blh = ibase_blob_create($this->db);   
    ibase_blob_add($blh, $img_str);
    $blobid = ibase_blob_close($blh);

    $row = false;
    /*$fd = fopen('Desert.jpg', 'r');
    $blob = ibase_blob_import($fd);
    fclose($fd); */
    $query = ibase_query($this->db, "INSERT INTO \"ud_ab\" (FILES) VALUES (?)", $img_str ) or die(ibase_errmsg());
    if($query) $row = true; 
    return $row;

试图用base64格式翻译图片,写了ibase_blob_add.Nothing help

1 个答案:

答案 0 :(得分:1)

这是用于保存图像的示例代码,但是在blob字段中

<div ng-show="vm.selectedCategory.category=='Cars'">
<input type="radio" ng-model="subcategory" value="2-Door">Coupe
<input type="radio" ng-model="subcategory" value="4-Door">Sedan
</div>
 
<section id="products" ng-show="productsVisible">
	<div ng-repeat="product in vm.selectedCategory.items" class="product">
		<a ng-show="product.subCategory===subcategory" href ng-click="vm.selectProduct(product); showResults();">{{product.name}}</a>
	</div>
</section>