在codeigniter中上传时,如何将图像大小调整为徽标和工厂图标?

时间:2019-07-18 02:46:38

标签: codeigniter-3

如何在Codeigniter中将图像调整为fab图标和徽标。如何在Codeigniter中将图像调整为fab图标和徽标。 我如何在Codeigniter中将图像调整为fab图标和徽标。 我如何在Codeigniter中将图像调整为fab图标和徽标。 如何在Codeigniter中将图像调整为fab图标和徽标。

     function logo_update()
 {
        $this->form_validation->set_rules('alt', 'alt', 'required');
        $this->form_validation->set_rules('logoid', 'logoid', 'required');

        $alt = $this->input->post('alt');


        $this->load->library('upload');


        if(isset($_FILES["logoImg"]))
        {
            $config['upload_path'] = './assets/front_assets/images/';
            $config['allowed_types'] = 'jpg|jpeg|png|gif';

            $config['file_name'] = $_FILES['logoImg']['name'];

           $this->load->library('upload');
           $this->upload->initialize($config);
           $this->image_lib->resize();
           if (!$this->upload->do_upload('logoImg'))
            {
                $result = array('msg' => $this->upload->display_errors());
                $data = new stdClass(); 
                $alt = $this->input->post('alt');
                $logoid    = $this->input->post('logoid');

                $result['return']=$this->logo_model->upload_logo_noimage($alt,$logoid);
                //Alert Message
                $messge = array('message' => 'Do not upload your logo','class' => 'warning');
                $this->session->set_flashdata('alert',$messge );
                $this->session->keep_flashdata('alert',$messge);

                redirect(base_url().'logo/view_logo','refresh');

            }
            else
            {
                $data = new stdClass(); 
                $alt = $this->input->post('alt');
                $logoid    = $this->input->post('logoid');
                $logo=$_FILES['logoImg']['name'];

                $result['return']=$this->logo_model->upload_logo($alt,$logoid,$logo);
                //Alert Message
                $messge = array('message' => 'Successfully upload your logo','class' => 'success');
                $this->session->set_flashdata('alert',$messge );
                $this->session->keep_flashdata('alert',$messge);
                redirect(base_url().'logo/view_logo','refresh');

            }


          }
          else
          {
            //Alert Message
            $messge = array('message' => 'Do not upload your logo','class' => 'danger');
            $this->session->set_flashdata('alert',$messge );
            $this->session->keep_flashdata('alert',$messge);
            redirect(base_url().'logo/view_logo','refresh');
          }
 }

0 个答案:

没有答案