Php 使用codeigniter将图像压缩并上载到表中,而不将图像存储在上载文件夹中

Php 使用codeigniter将图像压缩并上载到表中,而不将图像存储在上载文件夹中,php,html,codeigniter,Php,Html,Codeigniter,使用codeigniter将图像压缩并上载到数据库表中,而不将图像存储在上载文件夹中。我没有收到任何错误,但图像没有插入到表中。有错吗?请推荐我 控制器 public function buyer_profile_image() { $file_type = $_FILES['image']['type']; $allowed = array("image/jpeg", "image/gif", "image/png"); if (!in_ar

使用codeigniter将图像压缩并上载到数据库表中,而不将图像存储在上载文件夹中。我没有收到任何错误,但图像没有插入到表中。有错吗?请推荐我

控制器

public function buyer_profile_image() {

        $file_type = $_FILES['image']['type'];

        $allowed = array("image/jpeg", "image/gif", "image/png");
        if (!in_array($file_type, $allowed)) {
            $this->load->view('buyerprofile'); 
        } else {
            $source_img = $_FILES['image']['tmp_name'];


            $destination_img = 'destination .jpg';


            $d = $this->compress($source_img, $destination_img, 50);


            $image = addslashes($d);
            $image = file_get_contents($image);
            $image = base64_encode($image);


            if ($image == "") {
                $_SESSION["errmsg"] = "please select image to post";
                $this->load->view('buyerprofile'); 
            } else {

                $data = array(

                    'profile_image' => $image,

                              );

                $this->Profile_model->Product_insert($data);

                 $this->load->view('buyerprofile'); 

            }
        }
    }
型号

public  function Product_insert($data){
$this->db->insert('siddu',$data);
查看页面

<form  action="<?php echo base_url(); ?>Index.php/Profile_cntrl/buyer_profile_image" method="post"  enctype="multipart/form-data">
                <div class="text-center profile-bg">
                    <div class="user-bg"></div>
                    <a href="#" class="user-img">
                        <img src="<?php echo base_url(); ?>images/prasanthi.jpg" class="img-circle img-user" alt="" width="100px;" height="100px;"/>
                    </a>
                    <div class="user-info">
                        <span class="">xxxxxxx</span>
                        <div class="user-location">
                            <i class="fa fa-map-marker"></i> Bangalore
                        </div>
                    </div>



                        <div class="change-profile">
                            <!--<span data-role="upload" class="upload-trigger"><i class="fa fa-plus"></i> Change Profile</span>-->
                            <div class="attachment">
                                <input type="file" name="image" id="image"/>



                            </div>
                                                    <input type="submit" value="upload" class="btn btn-success" style="width:70px;"> 

                        </div>

                </div>
                      </form>

什么不起作用?您是否能够
回显$image