使用codeigniter,grocerycrud和image_moo时出错

时间:2017-07-07 01:02:48

标签: codeigniter

我有一个使用codeigniter,grocerycrud和image_moo的问题。代码如下所示。在使用xampp的生产服务器上,它工作正常,但是当将相同的代码上传到服务器以在linux下发布它时会出错。他正确上传图像,但当他试图处理对image_moo的调用时,他返回了一个javascript错误。我试图通过各种方式看到错误在哪里但到目前为止还没有解决方案。给你类似东西的人可以告诉我如何解决它?

谢谢

    public function index()
{
    $crud = new grocery_CRUD();
    $this->load->config ( 'grocery_crud' );
    $this->config->set_item ( 'grocery_crud_file_upload_allow_file_types', 'gif|jpeg|jpg|png' );

    $crud->set_theme ( 'datatables' );
    $crud->set_table ( 'portafolio' );
    $crud->set_subject ( 'imagen de portafolio' );
    $crud->columns ( 'imagen', 'descripcion_es', 'descripcion_en', 'activa' );
    $crud->required_fields ( 'activa', 'descripcion_es', 'descripcion_en', 'imagen' );
    $crud->set_field_upload ( 'imagen', 'uploads/portfolio' );
    $crud->display_as ( 'descripcion_es', 'Descripción ES' );
    $crud->display_as ( 'descripcion_en', 'Descripción EN' );
    //voy a reducir el tamano de la imagen siempre
    $crud->callback_after_upload ( array ( $this, 'reducir_350' ) );

    $output = $crud->render();

    $data [ 'grid'] = $output->output;

    $data [ 'css_files' ] = $output->css_files;
    $data [ 'js_files' ] = $output->js_files;       

    $data ['titulo_pagina'] = 'Imágenes de portafolio';
    $data ['menu_principal'] = $this->load->view ( 'back/view_menu', '', true );
    $this->load->view ( 'back/view_base', $data );
}


function reducir_350 ( $uploader_response, $field_info, $files_to_upload )
{
    $this->load->library ( 'image_moo' );
    //Is only one file uploaded so it ok to use it with $uploader_response[0].
    $file_uploaded = DIR_SITIO . $field_info->upload_path . '/' . $uploader_response[0]->name; 
    $file_savedto = DIR_SITIO . $field_info->upload_path . '/p-' . $uploader_response[0]->name; 
    $this->image_moo->load ( $file_uploaded )->resize_crop ( 350,250 )->save ( $file_savedto, true );
    return true;
}

0 个答案:

没有答案