当前位置: 首页>>代码示例>>PHP>>正文


PHP upload::process方法代码示例

本文整理汇总了PHP中upload::process方法的典型用法代码示例。如果您正苦于以下问题:PHP upload::process方法的具体用法?PHP upload::process怎么用?PHP upload::process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在upload的用法示例。


在下文中一共展示了upload::process方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: thumb_one

function thumb_one($path)
{
    $handle = new upload($path);
    /**********************
       //Create coloured Thumbsnail
       **********************/
    $handle->file_safe_name = false;
    $handle->file_overwrite = true;
    $handle->image_resize = true;
    $handle->image_ratio = true;
    $size = getimagesize($path);
    $factor = $size[0] / $size[1];
    $to_be_cut = abs(round(($size[0] - $size[1]) / 2));
    // determine how far we zoom in for making the thumbnail looking not streched
    if ($factor >= 1) {
        //picture horizontal
        $handle->image_y = 80;
        $handle->image_precrop = "0px " . $to_be_cut . "px";
    } else {
        //picture vertical
        $handle->image_x = 80;
        $handle->image_precrop = $to_be_cut . "px 0px";
    }
    $handle->process('/var/www/web360/html/felix/pics/thumbs/');
    /****************************
       //greyscale thumb (do rarely the same like before)
       *****************************/
    $handle->file_safe_name = false;
    $handle->file_overwrite = true;
    $handle->image_resize = true;
    $handle->image_ratio = true;
    $handle->image_greyscale = true;
    //only difference
    // determine how far we zoom in for making the thumbnail looking not streched
    if ($factor >= 1) {
        //picture horizontal
        $handle->image_y = 80;
        $handle->image_precrop = "0px " . $to_be_cut . "px";
    } else {
        //picture vertical
        $handle->image_x = 80;
        $handle->image_precrop = $to_be_cut . "px 0px";
    }
    $handle->process('/var/www/web360/html/felix/pics/thumbs/bw/');
    if (!$handle->processed) {
        die('error : ' . $handle->error);
    }
}
开发者ID:soi,项目名称:paul,代码行数:48,代码来源:thumbit.php

示例2: beforeSave

 public function beforeSave($options = array())
 {
     if (is_numeric(key($this->data['Foto']))) {
         $produto_id = $this->data['Foto']['produto_id'];
         foreach ($this->data['Foto'] as $key => $foto) {
             if (is_numeric($key)) {
                 if (!empty($foto['tmp_name'])) {
                     App::uses('upload', 'Vendor');
                     $imagem = new upload($foto);
                     if ($imagem->uploaded) {
                         $imagem->resize = true;
                         $imagem->imagem_x = 100;
                         $imagem->imagem_ratio_y = true;
                         $imagem->process('img/produtos/');
                         if ($imagem->processed) {
                             $_foto = array('produto_id' => $produto_id, 'arquivo' => $imagem->file_dst_name);
                             $this->create();
                             $this->save($_foto);
                         } else {
                             throw new Exception($imagem->error);
                         }
                     } else {
                         throw new Exception($imagem->error);
                     }
                 }
             }
         }
         if (!isset($_foto)) {
             return false;
         }
         $this->data['Foto'] = $_foto;
     }
 }
开发者ID:GabrielApG,项目名称:cakephp2_setor,代码行数:33,代码来源:Foto.php

示例3: handleMenuUpload

 public function handleMenuUpload()
 {
     $filename = $this->user->getMenuFile();
     if (!empty($_FILES['input_menu']['tmp_name']) && is_uploaded_file($_FILES['input_menu']['tmp_name'])) {
         $validImageTypes = array("jpg", "jpeg", "png", "pdf");
         if (filesize($_FILES['input_menu']['tmp_name']) > MAX_IMAGE_UPLOAD_FILESIZE) {
             echo "Upload is too big.";
             return false;
         }
         $menuUpload = new upload($_FILES['input_menu']);
         $menuUploadFolder = ASSETS_PATH . "downloads/";
         $menuFileInfo = pathinfo($_FILES['input_menu']['name']);
         $newFilenameBase = $this->user->getStub() . "_menu";
         $ext = strtolower(pathinfo($_FILES['input_menu']['name'], PATHINFO_EXTENSION));
         if (!in_array($ext, $validImageTypes)) {
             echo "invalidImageType";
             return false;
         }
         if ($menuUpload->uploaded) {
             ## Move uploaded file and resize
             $menuUpload->file_new_name_body = $newFilenameBase;
             $menuUpload->file_overwrite = true;
             $menuUpload->process($menuUploadFolder);
             if ($menuUpload->processed) {
                 $filename = $newFilenameBase . "." . $ext;
             } else {
                 echo $menuUpload->error;
             }
         } else {
             echo $menuUpload->error;
         }
     }
     return $filename;
 }
开发者ID:fantasticmrdavid,项目名称:hospo,代码行数:34,代码来源:UserController.php

示例4: uploadFileImage

 public function uploadFileImage($file, $ruta, $name)
 {
     if (isset($_FILES[$file]['name'])) {
         if ($_FILES[$file]['name']) {
             $upload = new upload($_FILES[$file], 'es_ES');
             $upload->allowed = array('image/jpg', 'image/jpeg', 'image/png', 'image/gif');
             $upload->file_max_size = '524288';
             // 512KB
             if ($name) {
                 $upload->file_new_name_body = 'upl_' . $name;
             } else {
                 $upload->file_new_name_body = 'upl_' . sha1(uniqid());
             }
             $upload->process($ruta);
             if ($upload->processed) {
                 //THUMBNAILS
                 $imagen = $upload->file_dst_name;
                 $thumb = new upload($upload->file_dst_pathname);
                 $thumb->image_resize = true;
                 $thumb->image_x = 150;
                 $thumb->image_y = 150;
                 //$thumb->file_name_body_pre= 'thumb_';
                 $thumb->process($ruta . 'thumb' . DS);
                 return true;
             } else {
                 throw new Exception('Error al subir la imagen: ' . $upload->error);
             }
         }
     } else {
         return false;
     }
 }
开发者ID:JonathanEstay,项目名称:panamericanaturismo.cl,代码行数:32,代码来源:Functions.php

示例5: upload

 /**
  * Uploads a new file for the given FileField instance.
  *
  * @param string $name EAV attribute name
  * @throws \Cake\Network\Exception\NotFoundException When invalid slug is given,
  *  or when upload process could not be completed
  */
 public function upload($name)
 {
     $instance = $this->_getInstance($name);
     require_once Plugin::classPath('Field') . 'Lib/class.upload.php';
     $uploader = new \upload($this->request->data['Filedata']);
     if (!empty($instance->settings['extensions'])) {
         $exts = explode(',', $instance->settings['extensions']);
         $exts = array_map('trim', $exts);
         $exts = array_map('strtolower', $exts);
         if (!in_array(strtolower($uploader->file_src_name_ext), $exts)) {
             $this->_error(__d('field', 'Invalid file extension.'), 501);
         }
     }
     $response = '';
     $uploader->file_overwrite = false;
     $folder = normalizePath(WWW_ROOT . "/files/{$instance->settings['upload_folder']}/");
     $url = normalizePath("/files/{$instance->settings['upload_folder']}/", '/');
     $uploader->process($folder);
     if ($uploader->processed) {
         $response = json_encode(['file_url' => Router::url($url . $uploader->file_dst_name, true), 'file_size' => FileToolbox::bytesToSize($uploader->file_src_size), 'file_name' => $uploader->file_dst_name, 'mime_icon' => FileToolbox::fileIcon($uploader->file_src_mime)]);
     } else {
         $this->_error(__d('field', 'File upload error, details: {0}', $uploader->error), 502);
     }
     $this->viewBuilder()->layout('ajax');
     $this->title(__d('field', 'Upload File'));
     $this->set(compact('response'));
 }
开发者ID:quickapps-plugins,项目名称:field,代码行数:34,代码来源:FileHandlerController.php

示例6: updateImage

 public function updateImage()
 {
     require_once 'helpers/upload.php';
     $code = '';
     if (isset($_POST['id']) && isset($_POST['path'])) {
         $id = intval($_POST['id']);
         $handle = new upload($_FILES['image_field']);
         if ($handle->uploaded) {
             $handle->file_new_name_body = $id;
             $handle->image_resize = true;
             $handle->image_x = 100;
             $handle->image_ratio_y = true;
             $handle->file_overwrite = true;
             $handle->process($_SERVER['DOCUMENT_ROOT'] . '/EduDB/imageUploads/');
             if ($handle->processed) {
                 $handle->clean();
             } else {
                 $_SESSION['ERROR'] = $handle->error;
                 // Failure
             }
         }
         Identity::updateImage($id, '/EduDB/imageUploads/' . $handle->file_dst_name);
     }
     header("Location: " . $_POST['path']);
 }
开发者ID:MatthewAry,项目名称:php-cs313,代码行数:25,代码来源:identity_controller.php

示例7: nuevo

 public function nuevo()
 {
     //verifica el rol y los permisos de usuario.
     $this->_acl->acceso('nuevo_post');
     //asigna titulo a la vista
     $this->_view->assign('titulo', 'Nuevo Post');
     //coloca el archivos js y js.validate.
     $this->_view->setJsPlugin(array('jquery.validate'));
     $this->_view->setJs(array('nuevo'));
     //si el archivo fue mandado entonces se asignan los valores de $_POST  a la variable datos.
     if ($this->getInt('guardar') == 1) {
         $this->_view->assign('datos', $_POST);
         //verifica si el post tiene titulo
         if (!$this->getTexto('titulo')) {
             $this->_view->assign('_error', 'Debe introducir el titulo del post');
             $this->_view->renderizar('nuevo', 'post');
             exit;
         }
         //verifica si el post tiene cuerpo
         if (!$this->getTexto('cuerpo')) {
             $this->_view->assign('_error', 'Debe introducir el cuerpo del post');
             $this->_view->renderizar('nuevo', 'post');
             exit;
         }
         $imagen = '';
         //verifica si se ha seleccionado un archivo tipo imagen
         if ($_FILES['imagen']['name']) {
             //se define la ruta de la imagen
             $ruta = ROOT . 'public' . DS . 'img' . DS . 'post' . DS;
             //Se crea un objeto upload con idioma español.
             $upload = new upload($_FILES['imagen'], 'es_Es');
             //se especifica el tipo de archivo.
             $upload->allowed = array('image/*');
             //se define un nombre para el archivo.
             $upload->file_new_name_body = 'upl_' . uniqid();
             //Se inicia la carga con la ruta destino especificada
             $upload->process($ruta);
             //si se ha logrado la carga entonces crear una miniatura con upload libreria.
             if ($upload->processed) {
                 $imagen = $upload->file_dst_name;
                 $thumb = new upload($upload->file_dst_pathname);
                 $thumb->image_resize = true;
                 $thumb->image_x = 100;
                 $thumb->image_y = 70;
                 $thumb->file_name_body_pre = 'thumb_';
                 $thumb->process($ruta . 'thumb' . DS);
             } else {
                 $this->_view->assign('_error', $upload->error);
                 $this->_view->renderizar('nuevo', 'post');
                 exit;
             }
         }
         //Luego de guardarse la imagen entonces se guarda el post
         $this->_post->insertarPost($this->getPostParam('titulo'), $this->getPostParam('cuerpo'), $imagen);
         //Se redicciona al index de post.
         $this->redireccionar('post');
     }
     //Se renderiza nuevamente la vista nuevo del post.
     $this->_view->renderizar('nuevo', 'post');
 }
开发者ID:enkee,项目名称:mvc20a,代码行数:60,代码来源:postController.php

示例8: nuevo

 public function nuevo()
 {
     $this->_acl->acceso('Administrador');
     $this->_view->assign('titulo', 'Nueva Aplicación');
     $this->_view->assign('tipo_app', $this->_aplicacion->getTipoApp());
     $this->_view->setJs(array('app'));
     if ($this->getInt('guardar') == 1) {
         $this->_view->assign('datos', $_POST);
         if (!$this->getTexto('nombre')) {
             $this->_view->assign('_error', 'Debe introducir nombre');
             $this->_view->renderizar('nuevo', 'aplicaciones');
             exit;
         }
         if (!$this->getTexto('descp')) {
             $this->_view->assign('_error', 'Debe introducir una descripción');
             $this->_view->renderizar('nuevo', 'aplicaciones');
             exit;
         }
         //Agregar demás verificaciones
         $imagen = '';
         if (isset($_FILES['imagen']['name'])) {
             $this->getLibrary('upload' . DS . 'class.upload');
             $ruta = ROOT . 'public' . DS . 'img' . DS . 'apps' . DS;
             $upload = new upload($_FILES['imagen'], 'es_Es');
             $upload->allowed = array('image/*');
             $upload->file_new_name_body = 'upl_' . uniqid();
             $upload->process($ruta);
             if ($upload->processed) {
                 $imagen = $upload->file_dst_name;
                 $thumb = new upload($upload->file_dst_pathname);
                 $thumb->image_resize = true;
                 $thumb->image_x = 100;
                 $thumb->image_y = 70;
                 $thumb->file_name_body_pre = 'thumb_';
                 $thumb->process($ruta . 'thumb' . DS);
             } else {
                 $this->_view->assign('_error', $upload->error);
                 $this->_view->renderizar('nuevo', 'aplicaciones');
                 exit;
             }
         }
         if ($this->_aplicacion->crearApp($_POST['nombre'], $_POST['descp'], $imagen, $_POST['url'], $_POST['host'], $_POST['usu'], $_POST['clave'], $_POST['nom_bd'], $_POST['puerto'], $_POST['tipo'])) {
             $this->_view->assign('datos', false);
             $this->_view->assign('_confirmacion', 'Conexión exitosa');
             $this->_view->renderizar('nuevo', 'aplicaciones');
             exit;
         } else {
             $this->_view->assign('_confirmacion', 'No se realizo la conexión, verifique los datos');
             $this->_view->renderizar('nuevo', 'aplicaciones');
             exit;
         }
     }
     $this->_view->renderizar('nuevo', 'aplicaciones');
     exit;
 }
开发者ID:AndresSalazarMarin,项目名称:GAIA-Integrador,代码行数:55,代码来源:aplicacionesController.php

示例9: makeThumb

	public function makeThumb() 
	{
		Yii::import('ext.image.class_upload.upload');
		
		$handle = new upload('.'.$this->imgPath.$this->image_name);
		$handle->image_resize            = true;
        $handle->image_ratio_crop        = 'T';
        $handle->image_x                 = 72;
        $handle->image_y                 = 72;
		$handle->process('.'.$this->thumbPath);
	}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:11,代码来源:ImageGallery.php

示例10: saveAction

 public function saveAction()
 {
     $cid = intval($_POST['wid']);
     $name = $_POST['name_cn'];
     $name_en = $_POST['name_en'];
     $type = $_POST['type'];
     $price = $_POST['price'];
     $desc = $_POST['desc'];
     $year = $_POST['years'];
     $active = isset($_POST['active']) && $_POST['active'] == 'on' ? 1 : 0;
     if ($cid) {
         $sql = "Update \n\t\t\t\t\t\t\t`product` \n\t\t\t\t\t\tset \n\t\t\t\t\t\t\t`name_cn`='" . ms($name) . "',\n\t\t\t\t\t\t\t`name_en`='" . ms($name_en) . "',\n\t\t\t\t\t\t\t`price`='" . intval($price) . "',\n\t\t\t\t\t\t\t`years`=" . intval($year) . ",\n\t\t\t\t\t\t\t`desc`='" . ms($desc) . "',\n\t\t\t\t\t\t\t`type`=" . intval($type) . ",\n\t\t\t\t\t\t\t`active`=" . intval($active) . ",\n\t\t\t\t\t\t\t`modify_time`=" . time() . " \n\t\t\t\t\t\twhere \n\t\t\t\t\t\t\t`id`=" . ms($cid);
     } else {
         $sql = "Insert into\n\t\t\t\t\t\t\t `product` (\n\t\t\t\t\t\t\t \t\t`name_cn`,\n\t\t\t\t\t\t\t \t\t`name_en`,\n\t\t\t\t\t\t\t \t\t`price`,\n\t\t\t\t\t\t\t \t\t`years`,\n\t\t\t\t\t\t\t \t\t`desc`,\n\t\t\t\t\t\t\t \t\t`type`,\n\t\t\t\t\t\t\t \t\t`active`,\n\t\t\t\t\t\t\t \t\t`modify_time`) \n\t\t\t\t\t\tValues(\n\t\t\t\t\t\t\t'" . ms($name) . "',\n\t\t\t\t\t\t\t'" . ms($name_en) . "',\n\t\t\t\t\t\t\t'" . ms($price) . "',\n\t\t\t\t\t\t\t'" . ms($year) . "',\n\t\t\t\t\t\t\t'" . ms($desc) . "',\n\t\t\t\t\t\t\t'" . ms($type) . "',\n\t\t\t\t\t\t\t'" . ms($active) . "',\n\t\t\t\t\t\t\t" . time() . "\n\t\t\t\t\t\t)";
     }
     if (DB::query($sql) && !$cid) {
         $b_id = DB::lastInsertID();
     } else {
         if (DB::query($sql) && $cid) {
             $b_id = $cid;
         }
     }
     if (!empty($_FILES)) {
         $order = 1;
         foreach ($_FILES as $i => $v) {
             if (!$v['error']) {
                 $handle1 = new upload($v);
                 if ($handle1->uploaded) {
                     $handle1->file_name_body_pre = '16du_';
                     $handle1->file_new_name_body = $b_id . '_' . $order;
                     //$handle1->file_new_name_ext  = 'png';
                     $handle1->file_overwrite = true;
                     $handle1->file_max_size = '40480000';
                     // $handle1->image_convert = 'png';
                     //$handle1->png_compression = 5;
                     $handle1->process(PRODUCT_SRC . $b_id . '/');
                     if ($handle1->processed) {
                         $sql = "Update `product` set `src" . $order . "` = '" . $handle1->file_dst_name . "' where `id`=" . $b_id;
                         DB::query($sql);
                         $handle1->clean();
                     } else {
                         //echo 'error : ' . $handle1->error;
                     }
                     $order++;
                 }
             }
         }
     }
     $res = new ResultObj(true, '', '保存成功');
     echo $res->toJson();
     exit;
 }
开发者ID:innomative,项目名称:16degrees,代码行数:52,代码来源:WineController.php

示例11: edit

 function edit()
 {
     $image = clear($_POST['image']);
     if ($_FILES['file']['name']) {
         if ($_POST['image']) {
             unlink($this->pathadm . $_POST['image']);
             unlink($this->pathadm . 'resize/' . $_POST['image']);
         }
         $upload = new upload();
         $upload->process($_FILES['file'], $this->pathadm, $this->max_width);
         $image = clear($upload->name);
     }
     $input = array('name' => clear($_POST['name']), 'alias' => clear($_POST['alias']), 'cha_id' => intval($_POST['cha']), 'cat_id' => intval($_POST['cat']), 'special' => intval($_POST['special']), 'description' => clear($_POST['description']), 'detail' => clear($_POST['detail']), 'image' => $image, 'cards_list' => @implode(',', $_POST['cards']), 'ordering' => (int) $ordering, 'card_slogan' => clear($_POST['card_slogan']));
     $this->db->update_record($this->table, $input, $this->key . '=' . $_GET['id']);
     security::redirect($this->module, 'list');
 }
开发者ID:sydneyDAD,项目名称:cardguys.com,代码行数:16,代码来源:class_news.php

示例12: modificar

 public function modificar()
 {
     if (strtolower($this->getServer('HTTP_X_REQUESTED_WITH')) == 'xmlhttprequest' || Session::get('sess_browser') == 'IE9') {
         $rutaIMG = ROOT . 'public' . DS . 'img' . DS . 'voucher' . DS;
         $MLV_agencia = $this->loadModel('agencia');
         //echo var_dump($_POST);
         //echo '<br>';echo '<br>';echo '<br>';
         //echo var_dump($_FILES); exit;
         if (isset($_FILES['flImagenVouAgen']['name'])) {
             if ($_FILES['flImagenVouAgen']['name']) {
                 //$this->getLibrary('upload' . DS . 'class.upload');
                 $upload = new upload($_FILES['flImagenVouAgen'], 'es_ES');
                 $upload->allowed = array('image/jpg', 'image/jpeg', 'image/png', 'image/gif');
                 $upload->file_max_size = '524288';
                 // 512KB
                 //$upload->file_new_name_body= 'upl_' . uniqid();
                 $upload->file_new_name_body = 'upl_' . Session::get('sessMOD_LV_idAgen');
                 $upload->process($rutaIMG);
                 if ($upload->processed) {
                     $MLV_agencia->actualizaVoucherAgen(Session::get('sessMOD_LV_idAgen'), $upload->file_dst_name);
                     echo 'OK';
                 } else {
                     throw new Exception($upload->error);
                 }
             } else {
                 throw new Exception('Debe seleccionar un archivo desde su computador...');
             }
         } else {
             if ($this->getTexto('chk_flImagenVouAgen')) {
                 if ($this->getTexto('chk_flImagenVouAgen') == 'on') {
                     if (Functions::eliminaFile($rutaIMG . Session::get('sessMOD_LV_imagen'))) {
                         $MLV_agencia->actualizaVoucherAgen(Session::get('sessMOD_LV_idAgen'), '');
                         echo 'OK';
                     } else {
                         throw new Exception('Error al eliminar el archivo, intente nuevamente');
                     }
                 } else {
                     throw new Exception('Debe seleccionar un archivo a eliminar');
                 }
             } else {
                 throw new Exception('Debe seleccionar un archivo desde su computador');
             }
         }
     } else {
         throw new Exception('Error inesperado, intente nuevamente. Si el error persiste comuniquese con el administrador');
     }
 }
开发者ID:JonathanEstay,项目名称:panamericanaturismo.cl,代码行数:47,代码来源:voucherController.php

示例13: edit

 function edit()
 {
     $image = clear($_POST['image']);
     if ($_FILES['file1']['name']) {
         if ($_POST['image']) {
             unlink($this->pathadm . $_POST['image']);
             unlink($this->pathadm . 'resize/' . $_POST['image']);
         }
         $upload1 = new upload();
         $upload1->process($_FILES['file1'], $this->pathadm, $this->max_width);
         $image = clear($upload1->name);
     }
     //var_dump($image); exit;
     $input = array('name' => clear($_POST['name']), 'alias' => clear($_POST['alias']), 'head_name' => clear($_POST['head_name']), 'top_list' => $toplist, 'top_type_name' => $topname, 'icon_on' => intval($_POST['iconchk']), 'header_text' => clear($_POST['header_text']), 'footer_text' => clear($_POST['footer_text']), 'ordering' => intval($_POST['ordering']), 'status' => intval($_POST['status']), 'cards_list' => implode(',', $_POST['cards']), 'sapxep' => implode(',', $_POST['sapxep']), 'title' => clear($_POST['title']), 'keyword' => clear($_POST['keyword']), 'destination' => clear($_POST['destination']), 'assign_banner' => clear($_POST['assign_banner']), 'banner' => intval($_POST['banner']), 'featured' => intval($_POST['featured']), 'image' => $image, 'card_slogan' => clear($_POST['card_slogan']));
     $this->db->update_record($this->table, $input, $this->key . '=' . intval($_GET['id']));
     security::redirect($this->module, 'list_qualitys');
 }
开发者ID:sydneyDAD,项目名称:cardguys.com,代码行数:17,代码来源:class_cards_quality.php

示例14: editarAction

 public function editarAction()
 {
     $this->view->setFile('editar');
     $user_id = $this->auth->getUserId();
     $this->request->setCustomFilters(array('email' => FILTER_VALIDATE_EMAIL));
     $post = $this->request->post();
     if (!empty($post)) {
         $atualizarUsuario = User::atualizar($user_id, $post);
         if ($atualizarUsuario->status === false) {
             $this->load('Helpers\\Alert', array('danger', 'Ops! Não foi possível atualizar seu perfil. <br> Verifique os erros abaixo:', $atualizarUsuario->errors));
         } else {
             if (isset($_FILES['image']) && !empty($_FILES['image']['tmp_name'])) {
                 $uploadUserImage = new upload($_FILES['image']);
                 if ($uploadUserImage->uploaded) {
                     $image_name = md5(uniqid());
                     $uploadUserImage->file_new_name_body = $image_name;
                     $uploadUserImage->file_new_name_ext = 'png';
                     $uploadUserImage->resize = true;
                     $uploadUserImage->image_x = 500;
                     $uploadUserImage->image_ratio_y = true;
                     $dir_path = ROOT_PATH . DS . 'public' . DS . 'uploads' . DS . 'users' . DS . $atualizarUsuario->user->id . DS;
                     $uploadUserImage->process($dir_path);
                     if ($uploadUserImage->processed) {
                         $uploadUserImage->clean();
                         $this->load('Helpers\\Alert', array('success', 'Uhuul! Perfil atualizado com sucesso!'));
                         if (!is_null($atualizarUsuario->user->image)) {
                             unlink($dir_path . $atualizarUsuario->user->image);
                         }
                         $atualizarUsuario->user->image = $image_name . '.png';
                         $atualizarUsuario->user->save(false);
                     } else {
                         $this->load('Helpers\\Alert', array('error', 'Oops! Não foi possível atualizar a sua imagem de perfil', $uploadUserImage->error));
                     }
                 }
             } else {
                 $this->load('Helpers\\Alert', array('success', 'Uhuul! Perfil atualizado com sucesso!'));
             }
             $this->view->setVar('user', $atualizarUsuario->user);
         }
     }
 }
开发者ID:brunosantoshx,项目名称:serie-criando-sistema-de-cadastro-e-login,代码行数:41,代码来源:PerfilController.php

示例15: newContact

 public function newContact()
 {
     $identity = array('fName' => $_POST['firstName'], 'mName' => $_POST['middleName'], 'lName' => $_POST['lastName'], 'gender' => $_POST['gender'], 'email' => $_POST['email'], 'type' => 2);
     $contactIdentityId = Identity::newIdentity($identity);
     if (!$contactIdentityId) {
         $_SESSION['Error'] = "Unable to create a Contact Identity!";
         header("Location: " . $_POST['path']);
         // TODO: This should go to an error page.
         return false;
     }
     require_once 'helpers/upload.php';
     $code = '';
     if ($contactIdentityId) {
         $id = intval($contactIdentityId);
         $handle = new upload($_FILES['image_field']);
         if ($handle->uploaded) {
             $handle->file_new_name_body = $id;
             $handle->image_resize = true;
             $handle->image_x = 100;
             $handle->image_ratio_y = true;
             $handle->file_overwrite = true;
             $handle->process($_SERVER['DOCUMENT_ROOT'] . '/EduDB/imageUploads/');
             if ($handle->processed) {
                 $handle->clean();
             } else {
                 $_SESSION['ERROR'] = $handle->error;
                 // Failure
             }
         }
         Identity::updateImage($id, '/EduDB/imageUploads/' . $handle->file_dst_name);
     }
     // If we get here then we have made an identity but have not linked it
     // to the target contact yet. We will need to set the relationship.
     if (!session_id()) {
         session_start();
     }
     $_SESSION['contact']['studentId'] = $_POST['studentId'];
     $_SESSION['contact']['studentIdentityId'] = $_POST['identityId'];
     $_SESSION['contact']['contactIdentityId'] = $contactIdentityId;
     header("Location: ?controller=contact&action=setRelationship");
 }
开发者ID:MatthewAry,项目名称:php-cs313,代码行数:41,代码来源:contact_controller.php


注:本文中的upload::process方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。