如何通过laravel播种机将blob图像插入oracle

时间:2015-05-06 13:18:32

标签: php oracle laravel oci8

我们正在尝试将Laravel播种机中的blob插入到oracle 11 g中。这在使用mysql数据库时工作正常。使用oracle db时,运行seeder through命令提示失败并输出一些垃圾值。如何通过Laravel播种器将图像blob插入oracle?

<?php
class TestSeeder extends Seeder {

/**
 * Run the database seeds.
 *
 * @return void
 */
public function run()
{
$jpg_image_filename  = "MMS-CREATE-UTIB-UTIB13117-20032015-375303_detailfront.jpg";  
        $grey_image = new Imagick("/var/www/test/public/images/".$jpg_image_filename);
        $jpg_image_data = $grey_image->getImageBlob();

$tif_image_filename = "MMS-CREATE-UTIB-UTIB13117-20032015-375303_front.tif";
        $bw_image = new Imagick("/var/www/test/public/images/".$tif_image_filename);
        $tif_image_data = $bw_image->getImageBlob();

        $data = array(  

            'JPG_IMAGE1' => $jpg_image_data,
            'TIF_IMAGE1' => $tif_image_data
            );

DB::table('test')->insert($data);
}

}

?>

0 个答案:

没有答案