Php 插入前调整图像大小-杂货店积垢/代码点火器

Php 插入前调整图像大小-杂货店积垢/代码点火器,php,codeigniter,grocery-crud,Php,Codeigniter,Grocery Crud,我试图通过杂货店Crud调整上传图像的大小,但有一些困难,因为我不确定如何访问POST数组中的内容,以便在代码中使用它 以下是我的控制器中执行图像上传的部分(特别是执行回调的部分): //Set up a call back function after the file has been uploaded to resize the image to save bandwidth/load times when displayed on the site $crud->c

我试图通过杂货店Crud调整上传图像的大小,但有一些困难,因为我不确定如何访问POST数组中的内容,以便在代码中使用它

以下是我的控制器中执行图像上传的部分(特别是执行回调的部分):

//Set up a call back function after the file has been uploaded to resize the image to save bandwidth/load times when displayed on the site
        $crud->callback_before_insert(array($this, 'resize_image'));
下面是我调用的函数:

private function resize_image ($post_array) 
    {
        $file_uploaded = $post_array (['image_url']);

        $config = array (
        'image_library' => 'gd2',
        'source_image'  => $file_uploaded,
        'create_thumb' => FALSE,
        'maintain_ratio' => TRUE,
        'width'  => 400,
        'height' => 300);

        $this->load->library('image_lib', $config);

        $this->image_lib->resize();

    }
上传仍然可以正常工作(即没有错误)但图像仍保持其原始大小。我确信这与我用
$file\u uploaded
变量填充的内容有关,但我不知道如何查看Grocery CRUD发布的内容,以查看我应该使用的内容。我确实打开了CI profiler,但我认为Grocery CRUD会在处理上载的内容时重定向在你有机会看到张贴的内容之前


有人能帮忙吗???

成功上传后,您必须调整图像的大小。有关详细信息,请查看下面的链接