0
當|我插入它顯示錯誤的圖像圖像插入不工作
無效的偏移
這是我的控制器。
我已經從我的項目中的其他頁面複製它,它在那裏工作 - 但在新頁面上顯示錯誤。
$config['upload_path'] = './assets/upload/'; /* NB! create this dir! */
$config['allowed_types'] = 'gif|jpg|png|bmp|jpeg';
$config['max_size'] = '2048';
$config['max_width'] = '5000';
$config['max_height'] = '5000';
/* Load the upload library */
$this->load->library('upload', $config);
/* Create the config for image library */
/* (pretty self-explanatory) */
$configThumb = array();
$configThumb['image_library'] = 'gd2';
$configThumb['source_image'] = '';
$configThumb['create_thumb'] = TRUE;
$configThumb['maintain_ratio'] = TRUE;
/* Set the height and width or thumbs */
/* Do not worry - CI is pretty smart in resizing */
/* It will create the largest thumb that can fit in those dimensions */
/* Thumbs will be saved in same upload dir but with a _thumb suffix */
/* e.g. 'image.jpg' thumb would be called 'image_thumb.jpg' */
$configThumb['width'] = 140;
$configThumb['height'] = 210;
/* Load the image library */
$this->load->library('image_lib');
$file=array();
$file_thumb=array();
/* We have 5 files to upload
* If you want more - change the 6 below as needed
*/
for($i = 1; $i < 3; $i++) {
/* Handle the file upload */
$upload = $this->upload->do_upload('image'.$i);
/* File failed to upload - continue */
if($upload === FALSE) continue;
/* Get the data about the file */
$data = $this->upload->data();
$file[$i] = $data['file_name'];
$file_thumb[$i] = $data['raw_name'].'_thumb'.$data['file_ext'];
$uploadedFiles[$i] = $data;
/* If the file is an image - create a thumbnail */
if($data['is_image'] == 1) {
$configThumb['source_image'] = $data['full_path'];
$this->image_lib->initialize($configThumb);
$this->image_lib->resize();
}
}
///=============upload end here==================////
echo $file['1'];
exit;
安置自己的完整的錯誤信息,包括您的形式! – Saty
一個PHP錯誤遇到 嚴重性:注意 消息:未定義抵消:1個 文件名:控制器/ biaso.php 行號:105 –