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


PHP upload::clean方法代码示例

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


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

示例1: 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

示例2: 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

示例3: saveFile

 public function saveFile($file)
 {
     $rep_dest = "../var/uploads/";
     $upload = new upload($file);
     $upload->file_overwrite = true;
     //supprime le fichier si existe
     if ($upload->uploaded) {
         //file
         $upload->file_new_name_body = uniqid();
         $upload->Process($rep_dest);
         $upload->clean();
         return $rep_dest . $upload->file_dst_name;
     }
     return null;
 }
开发者ID:aurellemeless,项目名称:favoris,代码行数:15,代码来源:import.class.php

示例4: 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

示例5: 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

示例6: elem

 public function elem($post, $get, $FILES)
 {
     require_once sys . '/plugin/class.upload/class.upload.php';
     $post = array_merge(array('chpu' => '', 'marker' => '', 'active_path' => ''), $post);
     $file = isset($FILES['form']) ? $FILES['form'] : array();
     $form = isset($post['form']) ? $post['form'] : array();
     $activePath = isset($post['active_path']) && $post['active_path'] != '' ? 1 : 0;
     $updateId = isset($post['id']) && $post['id'] != '' ? (int) $post['id'] : false;
     if ($updateId !== false) {
         Fx::db()->update(Fx::service_context()->namespace['construct_db'], array('chpu' => $post['chpu'], 'active_path' => $activePath, 'marker' => $post['marker'], 'date' => time()), array('id' => $updateId));
         $ref = Fx::db()->find(Fx::service_context()->namespace['construct_db'], array('ref' => $updateId));
         foreach ($ref as $v) {
             Fx::db()->update(Fx::service_context()->namespace['construct_db'], array('chpu' => $post['chpu'], 'active_path' => $post['active_path'], 'marker' => $post['marker'], 'date' => time()), array('id' => $v['id']));
         }
         $lastId = $updateId;
     } else {
         $num = count(Fx::db()->find(Fx::service_context()->namespace['construct_db'], array('parent' => (int) $post['parent'])));
         Fx::db()->insert(Fx::service_context()->namespace['construct_db'], array('parent' => (int) $post['parent'], 'ref' => '', 'object' => $post['object'], 'chpu' => $post['chpu'], 'num' => $num, 'active_path' => $activePath, 'marker' => $post['marker'], 'date' => time()));
         $form['id'] = $lastId = Fx::db()->lastID();
     }
     $table = Fx::db()->find(Fx::service_context()->namespace['struct_db'], array('code' => $post['object']));
     $table = $table[0];
     $row = Fx::db()->find(Fx::service_context()->namespace['struct_td'], array('parent' => $table['id']));
     $rows = array();
     foreach ($row as $v) {
         $rows[$v['code']] = array('id' => $v['id'], 'size' => $v['size'], 'type' => $v['type'], 'param' => json_decode($v['param'], true));
     }
     foreach ($form as $k => $v) {
         if (is_string($v)) {
             $form[$k] = Fx::db()->esc($v);
         }
     }
     foreach ($rows as $k => $v) {
         if (!isset($form[$k])) {
             $form[$k] = '';
         }
     }
     $path = root . '/' . Fx::service_context()->config['folder']['files'] . '/' . $lastId . '/';
     if (isset($file['tmp_name'])) {
         foreach ($file['tmp_name'] as $k => $v) {
             $savePath = '/' . Fx::service_context()->config['folder']['files'] . '/' . $lastId . '/';
             $fileName = isset($form[$k]['name']) && $form[$k]['name'] != '' ? trim($form[$k]['name']) : $k;
             $gist = $rows[$k];
             $fn = isset($form[$k]['url']) && $form[$k]['url'] != '' ? $form[$k]['url'] : $v['file'];
             $mime = Fx::io()->mime($file['name'][$k]['file'] != '' ? $file['name'][$k]['file'] : $form[$k]['url']);
             if (isset($form[$k]['url']) && $form[$k]['url'] !== '') {
                 Fx::io()->create_file(root . '/' . 'temporary.tmp');
                 Fx::io()->in_file(root . '/' . 'temporary.tmp', file_get_contents($fn));
                 $fn = root . '/' . 'temporary.tmp';
             }
             if ($fn != '') {
                 if (empty($fn)) {
                     continue;
                 }
                 $IMG = new upload($fn);
                 if ($IMG->uploaded) {
                     $IMG->file_new_name_body = $fileName;
                     $IMG->file_new_name_ext = $mime;
                     $gistParam = $gist['param'];
                     $width = isset($gistParam['width']) && $gistParam['width'] != '' ? $gistParam['width'] : 1000;
                     $height = isset($gistParam['height']) && $gistParam['height'] != '' ? $gistParam['height'] : 1000;
                     // Param
                     if (isset($gist['param']['method'])) {
                         switch ($gist['param']['method']) {
                             case 'scale':
                                 // Подгоняем по размеру и пропорциям, без полей
                                 $IMG->image_resize = true;
                                 $IMG->image_ratio = true;
                                 $IMG->image_y = $height;
                                 $IMG->image_x = $width;
                                 break;
                             case 'crop':
                                 // Точно по размеру игнорируя пропорции
                                 $IMG->image_resize = true;
                                 $IMG->image_ratio_crop = true;
                                 $IMG->image_y = $height;
                                 $IMG->image_x = $width;
                                 break;
                             case 'width':
                                 // ресайзим по ширине
                                 $IMG->image_resize = true;
                                 $IMG->image_ratio_x = true;
                                 $IMG->image_y = $height;
                                 break;
                             case 'height':
                                 // ресайзим по высоте
                                 $IMG->image_resize = true;
                                 $IMG->image_ratio_y = true;
                                 $IMG->image_x = $width;
                                 break;
                         }
                     }
                     if (is_file($path . $fileName . '.' . $mime)) {
                         unlink($path . $fileName . '.' . $mime);
                     }
                     $IMG->Process($path);
                     if (!$IMG->processed) {
                         setSystemMessage('error', $IMG->error);
                     }
                     $IMG->clean();
//.........这里部分代码省略.........
开发者ID:html2k,项目名称:Fenix,代码行数:101,代码来源:action.php

示例7: install

 function install()
 {
     $rep = $this->getResponse('json');
     $this->msg = "installation échouée";
     if (isset($_FILES["archive"])) {
         $rep_dest = "var/uploads/";
         $upload = new upload($_FILES["archive"]);
         $upload->file_overwrite = true;
         //supprime le file si existe
         $upload->allowed = array('application/zip');
         if ($upload->uploaded) {
             // It could be something like $upload->Process('www/my_uploads/');
             $upload->Process($rep_dest);
             //extraction de larchive
             $zip = new ZipArchive();
             $zip->open($upload->file_dst_pathname);
             //
             if (!$zip->getFromName('module.xml')) {
                 //if module file doesnt exists
                 $this->msg = "installation échouée: fichier d'installation absent";
             } else {
                 $moduleXml = simplexml_load_string($zip->getFromName('module.xml'));
                 //verifiying the compatibility with jelix core version
                 if ($this->compatibility($moduleXml->dependencies->jelix)) {
                     $zip->extractTo('modules/' . $moduleXml->info['name'] . '/');
                     //we extract to module directory
                     $this->setConfig($moduleXml->info['name']);
                     //set module config
                     $this->installScript($moduleXml->info['name']);
                     //$this->showOnMenu($moduleXml->info['name']);
                     $this->msg = "module installé";
                     $this->success = true;
                 } else {
                     $this->success = false;
                     $this->msg = "module non installé : versions non compatibles";
                 }
             }
             $zip->close();
             //close archive
             $upload->clean();
             //clean server temp
             unlink($upload->file_dst_pathname);
             //clean second app temp
         }
     }
     $rep->data = array('success' => $this->success, 'msg' => $this->msg);
     return $rep;
 }
开发者ID:aurellemeless,项目名称:favoris,代码行数:48,代码来源:installer.classic.php

示例8: upload

 function upload_excel_file()
 {
     $excel_file = $_FILES['excel_file'];
     $this->directory = PATH . "Excel_File/";
     if ($excel_file['name'] != "") {
         if ($excel_file["type"] == "application/vnd.ms-excel") {
             $excel_file_upload = new upload($excel_file);
             $excel_file_upload->file_overwrite = true;
             $excel_file_upload->file_new_name_body = "student_current_enroll";
             $excel_file_upload->process($this->directory);
             //if ($image_upload->processed) {
             //$this->registered();
             $this->template->setAlert("File was Successfully Uploaded!..", Template::ALERT_SUCCESS);
             $excel_file_upload->clean();
             $filename = "../Excel_File/student_current_enroll.xls";
             if (file_exists($filename)) {
                 $this->template->assign('excel_file', 'true');
             }
             /* inserting into database table */
             $excel_data = new Spreadsheet_Excel_Reader('../Excel_File/student_current_enroll.xls');
             for ($y = 2; $y <= $excel_data->rowCount(); $y++) {
                 $student_id = $excel_data->val($y, A);
                 $lastname = $excel_data->val($y, B);
                 $firstname = $excel_data->val($y, C);
                 $middle_initial = $excel_data->val($y, D);
                 if ($this->registered_student_model->isValid($student_id, $lastname, $firstname) && $this->administrator_model->isValid($student_id, $lastname, $firstname)) {
                     $this->registered_student_model->insert($student_id, $lastname, $firstname, $middle_initial);
                 }
             }
             /* ------------------------------- */
         } else {
             $this->template->setAlert("You can Upload a XLS file only!..", Template::ALERT_ERROR);
         }
     }
 }
开发者ID:bilfspk,项目名称:student-online-clearance-system,代码行数:35,代码来源:index.php

示例9: process

 public function process($parameters)
 {
     $articleManager = new ArticleManager();
     $userManager = new UserManager();
     $validation = new Validation();
     $this->checkUser();
     $loggedUser = $userManager->returnUser();
     //editor je pristupny iba pre admina a redaktorov
     if ($loggedUser['admin'] == 1 || $loggedUser['admin'] == 2) {
         $article = array('article_id' => '', 'title' => '', 'thumbnail_img' => '', 'content' => '', 'url' => '', 'category' => '', 'description' => '', 'key_words' => '', 'author' => '');
         //ak je odoslany formular
         if ($_POST) {
             //ziskanie clanku z $_POST
             $keys = array('article_id', 'title', 'thumbnail_img', 'content', 'url', 'category', 'description', 'key_words', 'author', 'public');
             $article = array_intersect_key($_POST, array_flip($keys));
             //upload a spracovanie suboru
             $imageUpload = new upload($_FILES['image_field'], 'sk_SK');
             //nastavenie ID noveho clanku
             if (empty($article['article_id'])) {
                 $article['article_id'] = $articleManager->returnLastArticleId() + 1;
             }
             $targetDirectory = 'img/articles/' . $article['article_id'] . '/';
             $filePath = $targetDirectory . 'thumbnail.png';
             try {
                 //vytvori novy adresar podla ID noveho clanku
                 if (!file_exists($targetDirectory)) {
                     mkdir($targetDirectory, '0777', true);
                 }
                 //ak bol obrazok nahraty
                 if ($imageUpload->uploaded) {
                     $imageUpload->allowed = array('image/*');
                     //povolene formaty
                     $imageUpload->mime_check = true;
                     //kontrola formatu zapnuta
                     $imageUpload->file_new_name_body = 'thumbnail';
                     //novy nazov suboru
                     $imageUpload->image_resize = true;
                     //zmensenie
                     $imageUpload->image_convert = 'png';
                     //konvertovanie na png
                     $imageUpload->image_x = 120;
                     //vysledna sirka 120px
                     $imageUpload->image_ratio_y = true;
                     //vyska: auto
                     //zmazanie existujuceho nahladoveho obrazka
                     if (file_exists($filePath)) {
                         unlink($filePath);
                     }
                     $imageUpload->process($targetDirectory);
                     //uloz vysledny obrazok
                     //ak bol obrazok ulozeny
                     if ($imageUpload->processed) {
                         //uloz cestu k obrazku do '$article'
                         $article['thumbnail_img'] = $filePath;
                         $imageUpload->clean();
                     } else {
                         throw new UserError($imageUpload->error);
                     }
                 }
             } catch (UserError $error) {
                 $this->createMessage($error->getMessage(), 'warning');
             }
             //ulozenie clanku do databazy
             try {
                 //vytvorenie URL adresy z pola title
                 $article['url'] = $validation->checkUrl($article['title']);
                 //ulozenie clanku do databazy
                 $articleManager->saveArticle($_POST['article_id'], $article);
                 $this->createMessage('Článok bol úspešne uložený', 'success');
                 //presmeruj na clanok
                 $this->redirect('clanky/' . $article['url']);
             } catch (UserError $error) {
                 $this->createMessage($error->getMessage(), 'warning');
                 $this->redirect('editor');
             }
         }
         //ak je zadana URL adresa clanku na jeho editaciu
         if (!empty($parameters[0])) {
             $loadedArticle = $articleManager->returnArticle($parameters[0]);
             if ($loadedArticle) {
                 $article = $loadedArticle;
             } else {
                 $this->createMessage('Článok sa nenašiel', 'warning');
                 $this->redirect('chyba');
             }
             $this->data['article'] = $article;
             //hlavicka stranky
             $this->head = array('title' => 'Editor - ' . $article['title'], 'key_words' => 'coding.wz.sk - editor', 'description' => 'Editor článkov');
             $this->view = 'editor';
         } else {
             $article['author'] = $userManager->returnUser()['name'];
             $this->data['article'] = $article;
             //hlavicka stranky
             $this->head = array('title' => 'Editor - Nový článok', 'key_words' => 'coding.wz.sk - editor', 'description' => 'Editor článkov');
             $this->view = 'editor';
         }
     }
 }
开发者ID:tomas3093,项目名称:cms-blog,代码行数:98,代码来源:EditorController.php

示例10: upload

        $klasor = "formlar/a5";
        /* CLASS.UPLOAD.PHP ��ER�S�NDEK� Y�KLEME FONKS�YONLARIMIZI KULLANMAYA BA�LIYORUZ. */
        /* SINIFIMIZI BA�LATIYORUZ */
        $yukle = new upload(@$resim);
        /* E�ER Y�KLEME ��LEM�M�Z GER�EKLE�T� �SE */
        if ($yukle->uploaded) {
            $yukle->process($klasor);
            /* RESM�M�Z�N TA�INACA�I KLAS�R */
            /* OPS�YONEL SE�ENEKLER VEROT.NET DEN DAHA FAZLA �ZELL��E ULA�AB�L�RS�N�Z. */
            $yukle->image_resize = true;
            /* RES�M BOYUTLANDIRMAYI AKT�FLE�T�R�YORUZ */
            $yukle->image_x = 250;
            /* GEN��L�K DE�ER� */
            $yukle->image_y = 200;
            /* Y�KSEKL�K DE�ER� */
            /* OPS�YONEL ��LEMLER BA�ARILI OLDU �SE */
            if ($yukle->processed) {
                /* Y�KLENEN DOSYA �SM�N� ALIP $yuklenen_resim DE���KEN�NE ATIYORUZ */
                $yuklenen_resim = $yukle->file_dst_name;
                /* Y�KLENEN RESM�M�Z� EKRANA BASIYORUZ (BU KISIMDA VER�TABANINA DA YAZDIRAB�L�RS�N�Z AMACINIZA UYGUN KULLANAB�L�RS�N�Z.)*/
                //print '<img src="resimler/'.$yuklenen_resim.'" />';
                /* EN SON $yukle DE���KEN�M�Z� TEM�ZL�YORUZ */
                $yukle->clean();
            }
            /* 3. �F B�T�� */
        }
        /* 2.�F B�T�� */
    }
    /* FOR B�T�� */
}
/* 1.�F B�T�� */
开发者ID:naimakin,项目名称:BitirmeProjesi,代码行数:31,代码来源:yukle_view.php

示例11: while

    // Count how many photos have already been uploaded for this ticket
    $i = 0;
    if ($handle = opendir($directory)) {
        while (($file = readdir($handle)) !== false) {
            if (!in_array($file, array('.', '..')) && !is_dir($directory . $file)) {
                $i++;
            }
        }
    }
    // Create new file name from directory count
    $filename = $i + 1;
    // Create new upload object with posted photo
    $photo = new upload($_FILES['photo']);
    // Configure photo processing options
    if ($photo->uploaded) {
        $photo->file_new_name_body = rand(0, 9999);
        $photo->image_convert = 'jpg';
        $photo->jpeg_quality = 70;
        $photo->png_compression = 7;
        $photo->image_resize = true;
        $photo->image_x = 1000;
        $photo->image_ratio_y = true;
        $photo->process($directory);
        if ($photo->processed) {
            // success!
            $photo->clean();
        } else {
            // echo 'error : ' . $photo->error;
        }
    }
}
开发者ID:tribey2,项目名称:mendhub,代码行数:31,代码来源:submit.php

示例12: UlozObrazek

function UlozObrazek($cesta, $nazev, $typmenu)
{
    $tmp_name = $_FILES["userfile"]["tmp_name"];
    if ($tmp_name) {
        $handle = new upload($_FILES['userfile']);
        $x = $handle->image_src_x;
        $y = $handle->image_src_y;
        $mratiox = 0;
        // Only proceed if the file has been uploaded
        if ($handle->uploaded) {
            // Set the new filename of the uploaded image
            $handle->file_new_name_body = "nahled-" . $nazev;
            // Make sure the image is resized
            switch ($typmenu) {
                case "V":
                    $maxx = X_VISUAL_NAHLED;
                    $maxy = Y_VISUAL_NAHLED;
                    break;
                case "P":
                    $maxx = X_PUDORYS_NAHLED;
                    $maxy = Y_PUDORYS_NAHLED;
                    break;
                case "M":
                    $maxx = X_DUM_NAHLED;
                    $maxy = Y_DUM_NAHLED;
                    break;
                default:
                    $maxx = X_DUM_NAHLED;
                    $maxy = Y_DUM_NAHLED;
            }
            if ($x != $maxx || $y != $maxy) {
                // Set the width of the image
                if ($mratiox) {
                    $handle->image_resize = true;
                    $handle->image_x = $maxx;
                    $handle->image_ratio_y = true;
                    echo "OBRAZEK ZMENEN NA {$maxx},{$maxy} : a ratiox:" . $mratiox;
                } else {
                    $handle->image_resize = true;
                    $handle->image_x = $maxx;
                    $handle->image_y = $maxy;
                }
                $handle->jpeg_quality = 100;
                $handle->process($cesta);
            } else {
                $handle->image_resize = false;
                $handle->process($cesta);
            }
            switch ($typmenu) {
                case "V":
                    $ratiox = X_VISUAL_VELKE;
                    break;
                case "P":
                    $ratiox = X_PUDORYS_VELKE;
                    break;
                case "M":
                    $ratiox = 0;
                default:
                    $ratiox = 0;
            }
            if ($ratiox) {
                if ($x > $ratiox) {
                    $handle->image_resize = true;
                    $handle->image_ratio_y = true;
                    $handle->image_x = $ratiox;
                } else {
                    $handle->image_resize = false;
                    $handle->image_x = $x;
                    $handle->image_y = $y;
                }
                $handle->file_new_name_body = "obr-" . $nazev;
                $handle->process($cesta);
            }
            if ($handle->processed) {
                $nazevobr = $handle->file_dst_name;
                $handle->clean();
            } else {
                echo 'error : ' . $handle->error;
                return 0;
            }
            return $nazevobr;
        }
    }
}
开发者ID:ctiborv,项目名称:koneridec.cz,代码行数:84,代码来源:admfunkce.php

示例13:

    if ($upload_image->uploaded) {
        // ย่อขนาดภาพให้เล็กลงหน่อย  โดยยึดขนาดภาพตามความกว้าง  ความสูงให้คำณวนอัตโนมัติ
        // ถ้าหากไม่ต้องการย่อขนาดภาพ ก็ลบ 3 บรรทัดด้านล่างทิ้งไปได้เลย
        $upload_image->image_resize = true;
        // อนุญาติให้ย่อภาพได้
        $upload_image->image_x = 1024;
        // กำหนดความกว้างภาพเท่ากับ 400 pixel
        $upload_image->image_ratio_y = true;
        // ให้คำณวนความสูงอัตโนมัติ
        $upload_image->process("upload_images");
        // เก็บภาพไว้ในโฟลเดอร์ที่ต้องการ  *** โฟลเดอร์ต้องมี permission 0777
        // ถ้าหากว่าการจัดเก็บรูปภาพไม่มีปัญหา  เก็บชื่อภาพไว้ในตัวแปร เพื่อเอาไปเก็บในฐานข้อมูลต่อไป
        if ($upload_image->processed) {
            $image_name = $upload_image->file_dst_name;
            // ชื่อไฟล์หลังกระบวนการเก็บ จะอยู่ที่ file_dst_name
            $upload_image->clean();
            // คืนค่าหน่วยความจำ
            $image_path = "upload_images/" . $image_name;
            // กำหนด sql ใหม่ เพื่อให้เก็บชื่อภาพลงฐานข้อมูลด้วย
            $sql = "UPDATE  `siitticket`.`machine` SET  `name` =  '{$mname}' , `owner` = '{$owner}',`place` = '{$place}',`image` = '{$image_path}',`os` = '{$os}' , `tuid` = '{$tuid}' , `detail` = '{$detail}' WHERE  `machine`.`mid` ='{$mid}'";
            //echo $insertSQL ;
            //mysql_select_db($database_connection, $connection);
            //$Result1 = mysql_query($insertSQL, $connection) or die(mysql_error());
        }
        // END if ( $upload_image->processed )
    }
    //END if ( $upload_image->uploaded )
    //$sql = "insert into image (id, image) values ('', '$image') ";  //เพิ่มข้อมูลลงดาต้าเบส โดยเก็บชื่อรูปไว้
    // $dbquery = mysql_db_query($dbname, $sql);
}
include "connectdb.php";
开发者ID:jiyokaa,项目名称:ticket,代码行数:31,代码来源:editMachineProcess.php

示例14: array

        $handle2->image_x = 100;
        $handle2->image_ratio_y = true;
        $handle2->allowed = array('image/*');
        $handle2->image_convert = 'jpg';
        $handle2->file_overwrite = true;
        $handle2->process('..uploads/talent/talent_profiles/');
        if ($handle2->processed) {
            // save uploaded file name and path in database table field logo_url
            $last_modified_by = $_SESSION['user_id'];
            $last_modified_on = getDateTime(NULL, "mySQL");
            /* if client id is not empty update the database */
            if ($talent_id != "") {
                $update = DB::update('tams_talent', array('photo2_url' => '/talent/uploads/talent/talent_profiles/' . $talent_id . '_photo1.jpg', 'last_modified_by' => $last_modified_by, 'last_modified_on' => $last_modified_on), "talent_id=%s", $talent_id);
            }
            echo 'Photo is uploaded and path select saved in database';
            $handle2->clean();
        } else {
            echo 'error : ' . $handle2->error;
        }
        // close handle processed
    }
    // close handle uploaded
    //if update is successful redirect the page to view client list
    if ($update) {
        echo '<script>alert("Edited Details Successfully");</script>';
        echo '<script>window.location.replace("' . $_SERVER['PHP_SELF'] . '?route=modules/talent/view_talents");</script>';
    }
}
if (isset($_GET['talent_id'])) {
    $talent_id = $_GET['talent_id'];
    $sql = "SELECT\n\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\ttams_talent\n\t\t\t\tWHERE talent_id = {$talent_id} ;";
开发者ID:rmak78,项目名称:talentagency,代码行数:31,代码来源:inc_talent_basic.php

示例15: resize

 public static function resize($src_imagepath, $src_imagefilename, $ndest_loc, $nwidth, $nheight, $nfilename)
 {
     try {
         if (!JFile::exists(JPATH_ROOT . DS . 'components' . DS . 'com_jvrelatives' . DS . 'helpers' . DS . 'class.resize_image.php')) {
             throw new Exception("Verot does not exist. JV-LD component may not be installed");
         }
         require_once JPATH_ROOT . DS . 'components' . DS . 'com_jvrelatives' . DS . 'helpers' . DS . 'class.resize_image.php';
         JvrelInit::debug('resize: Uploaded file: ' . $src_imagepath . DS . $src_imagefilename);
         // copy file to /tmp/subdir
         $t = time() . rand(0, 99999);
         if (!JFolder::exists(_JVREL_ABS_JTMP . DS . $t)) {
             JFolder::create(_JVREL_ABS_JTMP . DS . $t);
         }
         JFile::copy($src_imagepath . DS . $src_imagefilename, _JVREL_ABS_JTMP . DS . $t . DS . $src_imagefilename);
         $handle = new upload(_JVREL_ABS_JTMP . DS . $t . DS . $src_imagefilename);
         $handle->image_resize = true;
         $handle->file_overwrite = false;
         $handle->image_convert = 'jpg';
         $handle->image_x = $nwidth;
         if ($nheight) {
             $handle->image_y = $nheight;
         } else {
             $handle->image_ratio_y = true;
         }
         $handle->file_new_name_body = substr($nfilename, 0, -4);
         $handle->process($ndest_loc);
         $handle->clean();
         @JFolder::delete(_JVREL_ABS_JTMP . DS . $t);
         return $nfilename;
     } catch (Exception $ex) {
         JvrelInit::debug($ex->getMessage());
         return "";
     }
 }
开发者ID:site4com,项目名称:prometheus,代码行数:34,代码来源:class.init.php


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