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


PHP Upload::Process方法代码示例

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


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

示例1: imgUpload

    /**
     * @desc sube una imagen jpg al servidor
     * @param void
     * @return void
     */
    private function imgUpload()
    {
        $msg = "";
        $dir = IMG_LOCAL_PATH . "eventos/" . $this->_event_id;
        $dirweb = IMG_WEB_PATH . "eventos/" . $this->_event_id;
        $handle = new Upload($_FILES['urlfoto']);
        if ($handle->uploaded) {
            // movemos de temp a dir final
            $handle->Process($dir);
            // we check if everything went OK
            if ($handle->processed) {
                // everything was fine !
                $msg .= '!Carga exitosa!: 
	            <a href="' . $dirweb . '/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a>';
            } else {
                // one error occured
                $msg .= '<fieldset>';
                $msg .= '  <legend>No es posible mover la imagen en la ruta indicada</legend>';
                $msg .= '  Error: ' . $handle->error . '';
                $msg .= '</fieldset>';
            }
            // we delete the temporary files
            $handle->Clean();
        } else {
            // if we're here, the upload file failed for some reasons
            // i.e. the server didn't receive the file
            $msg .= '<fieldset>';
            $msg .= '  <legend>No es pposible cargar la imagen al servidor.</legend>';
            $msg .= '  Error: ' . $handle->error . '';
            $msg .= '</fieldset>';
        }
        return $msg;
    }
开发者ID:peterweck,项目名称:catman,代码行数:38,代码来源:filebrowser.php

示例2: updateImage

        return $this->db->lastInsertId();
    }
    /**
	* Update image
	*/
    public function updateImage($id)
    {
        $ruler = new Ruler($id);
        if ($ruler->Background == null) {
            return false;
        }
        require_once 'core/class.upload/class.upload.php';
        $templates = DIR_DBIMAGES . 'ruler/templates/';
        $results = DIR_DBIMAGES . 'ruler/results/';
        $iu = new Upload($templates . $ruler->Background);
        $iu->file_overwrite = true;
        $iu->file_new_name_body = $id;
        $iu->file_new_name_ext = 'jpg';
        $iu->image_unsharp = true;
        $iu->image_border = '0 0 16 0';
        $iu->image_border_color = strtolower($ruler->Color) == '#ffffff' ? '#333333' : '#ffffff';
        $iu->image_watermark = $templates . $ruler->Slider;
        $iu->image_watermark_y = 35;
        $iu->image_watermark_x = $ruler->getSliderPosition();
        $iu->Process($results);
        $image = imagecreatefromjpeg($results . $id . '.jpg');
开发者ID:AleksandrChukhray,项目名称:good_deals,代码行数:26,代码来源:Ruler.php

示例3: array

 function asignar_cotizacion($id_equipo, $placa_inventario)
 {
     App::import('Vendor', 'upload', array('file' => 'class.upload.php'));
     $this->autoLayout = false;
     $this->autoRender = false;
     $datos_json = array('resultado' => false, 'id' => '', 'nombre_archivo' => '');
     if (!empty($_FILES) && !empty($id_equipo) && !empty($placa_inventario)) {
         if (!empty($_FILES['cotizacion']['name'])) {
             $handle = new Upload($_FILES['cotizacion']);
             if ($handle->uploaded) {
                 $handle->file_overwrite = true;
                 $handle->file_safe_name = false;
                 $handle->file_auto_rename = false;
                 $handle->file_new_name_body = 'cotizacion(' . $this->Cotizacion->getNextAutoIncrement() . ')_' . $placa_inventario;
                 $handle->Process('equipos/cotizaciones');
                 if ($handle->processed) {
                     $this->data['Cotizacion']['nombre_archivo'] = $handle->file_dst_name;
                     $this->data['Cotizacion']['id_equipo'] = $id_equipo;
                     $this->data['Cotizacion']['placa_inventario'] = $placa_inventario;
                     if ($this->Cotizacion->save($this->data)) {
                         $datos_json['resultado'] = true;
                         $datos_json['id'] = $this->Cotizacion->id;
                         $datos_json['nombre_archivo'] = $this->data['Cotizacion']['nombre_archivo'];
                     }
                 }
                 $handle->Clean();
             }
         }
     }
     return json_encode($datos_json);
 }
开发者ID:hongo-de-yuggoth,项目名称:SIMAU,代码行数:31,代码来源:cotizaciones_controller.php

示例4: __construct

 public function __construct($feed, $type)
 {
     $this->feedArray = $feed;
     $this->feedType = $type;
     $this->size = '1000000';
     $maxSize = $this->size / 1000000;
     if ($this->feedType == 'text') {
         $this->feedText = $feed;
     } else {
         if ($this->feedType == 'img') {
             $this->feedImg = $feed['image'];
             $this->feedText = $feed['text'];
             $this->newName = $_SESSION['isv_user_id'] . str_replace(' ', '', microtime());
             $this->newName = str_replace('.', '', $this->newName);
             $path = ISVIPI_UPLOADS_BASE . 'feeds/';
             //check file size
             if ($this->feedImg["size"] > $this->size) {
                 $array['err'] = true;
                 $array['message'] = 'The file is too large. Maximum file size is ' . $maxSize . ' MB.';
                 echo json_encode($array);
                 exit;
             }
             //check file type
             if ($this->feedImg["type"] != "image/jpg" && $this->feedImg["type"] != "image/png" && $this->feedImg["type"] != "image/jpeg" && $this->feedImg["type"] != "image/gif") {
                 $array['err'] = true;
                 $array['message'] = 'Allowed file types are .jpg .jpeg .png .gif';
                 echo json_encode($array);
                 exit;
             }
             //require file upload class
             require_once ISVIPI_CLASSES_BASE . 'utilities/class.upload.php';
             $newUpload = new Upload($this->feedImg);
             $newUpload->file_new_name_body = ISVIPI_600 . $this->newName;
             $newUpload->image_resize = true;
             $newUpload->image_convert = 'jpg';
             $newUpload->image_x = 600;
             $newUpload->image_ratio_y = true;
             $newUpload->Process($path);
             if (!$newUpload->processed) {
                 $array['err'] = true;
                 $array['message'] = 'An error occurred: ' . $newUpload->error . '';
                 echo json_encode($array);
                 exit;
             }
             $newUpload->Clean();
         }
     }
     /** add our feed to the database **/
     $this->addFeed();
     /** return success **/
     $array['err'] = false;
     echo json_encode($array);
     exit;
 }
开发者ID:redconan,项目名称:IsVipi-OSSN,代码行数:54,代码来源:feeds_cls.php

示例5: save

 /**
  * Logic to save an item
  *
  * @access public
  * @return void
  * @since 1.0
  */
 function save()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.archive');
     require_once HOTELGUIDE_ADMINISTRATOR . DS . 'lib' . DS . 'class.upload.php';
     $task = JRequest::getVar('task');
     $post = JRequest::get('post');
     $model = $this->getModel('admanager');
     $data = $model->getFile($post['id']);
     if (isset($_FILES['file_upload'])) {
         $handle = new Upload($_FILES['file_upload']);
         if ($handle->uploaded) {
             $dir = HOTELGUIDE_IMAGES_BANNER . DS;
             if (!file_exists($dir)) {
                 mkdir($dir, 0777);
             }
             $handle->jpeg_quality = 100;
             $handle->file_auto_rename = false;
             $handle->file_overwrite = true;
             $width = $handle->image_src_x;
             $height = $handle->image_src_y;
             $handle->file_new_name_body = $file_body;
             $handle->Process($dir);
             $post['filename'] = $handle->file_dst_name;
             $post['imagewidth'] = $width;
             $post['imageheight'] = $height;
             $handle->Clean();
         }
     }
     if ($model->store($post)) {
         switch ($task) {
             case 'apply':
                 $link = 'index.php?option=com_hotelguide&view=admanager&cid[]=' . (int) $model->get('id');
                 break;
             default:
                 $link = 'index.php?option=com_hotelguide&view=admanagers';
                 break;
         }
         $msg = JText::_('HG_AD_ITEM_SAVED');
         $cache =& JFactory::getCache('com_hotelguide');
         $cache->clean();
     } else {
         $msg = JText::_('HG_ERROR_SAVING_ITEM');
         JError::raiseError(500, $model->getError());
         $link = 'index.php?option=com_hotelguide&view=admanager';
     }
     $model->checkin();
     $this->setRedirect($link, $msg);
 }
开发者ID:raulrotundo,项目名称:jpmoser_guide,代码行数:58,代码来源:admanagers.php

示例6: add

 public static function add($f)
 {
     $foo = new Upload($f);
     if ($foo->uploaded) {
         $foo->Process(TMPFILES);
     }
     if ($foo->processed) {
         $fname = $foo->file_src_name_body;
         $fpath = TMPFILES . DS . $fname;
         $zip = new ZipArchive();
         $res = $zip->open(TMPFILES . DS . $foo->file_src_name);
         if ($res === TRUE) {
             $zip->extractTo($fpath . DS);
             $zip->close();
             $pack = json_decode(file_get_contents($fpath . DS . 'package.json'), true);
             if (count($pack['controllers']) > 0) {
                 foreach ($pack['controllers'] as $c) {
                     File::copy($fpath . DS . 'controllers' . DS . $c, CONTROLLERS . DS . $c);
                 }
             }
             if (count($pack['views']) > 0) {
                 foreach ($pack['views'] as $c) {
                     File::copy($fpath . DS . 'views' . DS . $c, VIEWS . DS . $c);
                 }
             }
             if (count($pack['langs']) > 0) {
                 foreach ($pack['langs'] as $c) {
                     File::copy($fpath . DS . 'lang' . DS . $c, LANGS . DS . $c);
                 }
             }
             if (count($pack['libs']) > 0) {
                 foreach ($pack['libs'] as $c) {
                     File::copy($fpath . DS . 'lib' . DS . $c, LIB . DS . $c);
                 }
             }
             if (count($pack['filters']) > 0) {
                 foreach ($pack['filters'] as $c) {
                     File::copy($fpath . DS . 'filters' . DS . $c, FILTER . DS . $c);
                 }
             }
             File::copy($fpath . DS . 'package.json', CONFPLUGINS . DS . $pack['name'] . '.json');
             File::copy($fpath . DS . 'routes.php', ROOT . DS . "routes" . DS . $pack['name'] . '.routes.php');
             File::removedir($fpath);
             File::remove(TMPFILES . DS . $foo->file_src_name);
         } else {
             return false;
         }
     }
     return true;
 }
开发者ID:h4kbas,项目名称:Just,代码行数:50,代码来源:plugin.class.php

示例7: save

 /**
  * save a record (and redirect to main page)
  * @return void
  */
 function save()
 {
     JRequest::checkToken() or jexit('Invalid Token');
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.archive');
     require_once HOTELGUIDE_ADMINISTRATOR . DS . 'lib' . DS . 'class.upload.php';
     $post = JRequest::get('post');
     $file = JRequest::getVar('file_upload', '', 'files', 'array');
     $task = JRequest::getVar('task');
     $model =& $this->getModel('facility');
     $filename = '';
     if (isset($_FILES['file_upload'])) {
         $filename = $_FILES['file_upload']['name'];
         $post['pictogram'] = $filename;
         $handle = new Upload($_FILES['file_upload']);
         if ($handle->uploaded) {
             $dir = HOTELGUIDE_IMAGES_PICTOGRAM . DS;
             if (!file_exists($dir)) {
                 mkdir($dir, 0777);
             }
             $handle->jpeg_quality = 100;
             $handle->file_auto_rename = false;
             $handle->file_overwrite = true;
             $width = $handle->image_src_x;
             $height = $handle->image_src_y;
             $handle->Process($dir);
             $handle->Clean();
         }
     }
     if ($model->store($post)) {
         switch ($task) {
             case 'apply':
                 $link = 'index.php?option=com_hotelguide&view=facility&cid[]=' . (int) $model->get('id');
                 break;
             case 'saveandnew':
                 $link = 'index.php?option=com_hotelguide&view=facility';
                 break;
             default:
                 $link = 'index.php?option=com_hotelguide&view=facilities';
                 break;
         }
         $msg = JText::_('HG_FACILITY_SAVED');
     } else {
         $link = 'index.php?option=com_hotelguide&view=facilities';
         $msg = JText::_('HG_ERROR_SAVING_FACILITY');
     }
     $this->setRedirect($link, $msg);
 }
开发者ID:raulrotundo,项目名称:jpmoser_guide,代码行数:52,代码来源:facilities.php

示例8: upload

 public function upload($curso_id)
 {
     $msg = false;
     $handle = new Upload($_FILES['agenda']);
     if ($handle->uploaded) {
         $handle->Process('files');
         if ($handle->processed) {
             rename(FILES_PATH . $handle->file_dst_name, FILES_PATH . $curso_id . ".pdf");
             return 1;
         } else {
             $msg = $handle->error;
         }
         $handle->Clean();
     } else {
         $msg = $handle->error;
     }
     return $msg;
 }
开发者ID:peterweck,项目名称:catman,代码行数:18,代码来源:Agendas.php

示例9: createUserPicture

function createUserPicture($userPicture)
{
    $user_picture_name = $_SESSION['uuID'];
    $userPicture = new Upload($_FILES['user_image']);
    if ($userPicture->uploaded) {
        $userPicture->file_new_name_body = $user_picture_name;
        $userPicture->image_resize = true;
        $userPicture->image_x = 300;
        $userPicture->image_ratio_y = true;
        $userPicture->file_overwrite = true;
        $userPicture->image_convert = 'png';
        // save uploaded image with no changes
        $userPicture->Process('../profileImg');
        if ($userPicture->processed) {
            echo 'original image copied';
        } else {
            echo 'error : ' . $foo->error;
        }
    }
}
开发者ID:valeri4,项目名称:semiProjectlayers,代码行数:20,代码来源:userUploadImg.php

示例10: newUploadFile

 public static function newUploadFile($archivoSubir, $rutaGuardarArchivo = 'UploadedFiles')
 {
     //Crea Una Nueva Instancia de la clase de subir archivos.
     $archivo = new Upload($archivoSubir, 'es_ES');
     // Verificamos si se puede subir el archivo
     if ($archivo->uploaded) {
         //Le damos un nuevo nombre al archivo para que no se duplique.
         $nuevoNombre = date('HMs') . "_" . $archivo->file_src_name_body;
         $archivo->file_new_name_body = $nuevoNombre;
         //Subimos el archivo a la ruta dada ($rutaGuardarArchivo).
         $archivo->Process($rutaGuardarArchivo);
         //Verificamos si subio
         if ($archivo->processed) {
             echo "Archivo Subido";
             //Obtenemos la extension del archivo Subido
             $extension = $archivo->file_src_name_ext;
             return $nuevoNombre . "." . $extension;
         }
         $archivos->Clean();
     } else {
         echo "Error al subir el archivo..." . $archivo->error;
         return NULL;
     }
 }
开发者ID:manuelrodriguez08,项目名称:Php,代码行数:24,代码来源:generic_functions_class.php

示例11: upload_job_category_photo

 /**
  * 	Munka kategória képet méretezi és tölti fel a szerverre (thumb képet is)
  * 	(ez a metódus a category_insert() metódusban hívódik meg!)
  *
  * 	@param	$files_array	Array ($_FILES['valami'])
  * 	@return	String (kép elérési útja) or false
  */
 private function upload_job_category_photo($files_array)
 {
     include LIBS . "/upload_class.php";
     // feltöltés helye
     $imagePath = Config::get('jobphoto.upload_path');
     //képkezelő objektum létrehozása (a kép a szerveren a tmp könyvtárba kerül)
     $handle = new Upload($files_array);
     // fájlneve utáni random karakterlánc
     $suffix = md5(uniqid());
     //file átméretezése, vágása, végleges helyre mozgatása
     if ($handle->uploaded) {
         // kép paramétereinek módosítása
         $handle->file_auto_rename = true;
         $handle->file_safe_name = true;
         $handle->allowed = array('image/*');
         $handle->file_new_name_body = "jobcategory_" . $suffix;
         $handle->image_resize = true;
         $handle->image_x = Config::get('jobphoto.width', 300);
         //jobphoto kép szélessége
         $handle->image_y = Config::get('jobphoto.height', 200);
         //jobphoto kép magassága
         //$handle->image_ratio_y           = true;
         //képarány meghatározása a nézőképhez
         $ratio = $handle->image_x / $handle->image_y;
         // Slide kép készítése
         $handle->Process($imagePath);
         if ($handle->processed) {
             //kép elérési útja és új neve (ezzel tér vissza a metódus, ha nincs hiba!)
             //$dest_imagePath = $imagePath . $handle->file_dst_name;
             //a kép neve (ezzel tér vissza a metódus, ha nincs hiba!)
             $image_name = $handle->file_dst_name;
         } else {
             Message::set('error', $handle->error);
             return false;
         }
         // Nézőkép készítése
         //nézőkép nevének megadása (kép új neve utána _thumb)
         $handle->file_new_name_body = $handle->file_dst_name_body;
         $handle->file_name_body_add = '_thumb';
         $handle->image_resize = true;
         $handle->image_x = Config::get('jobphoto.thumb_width', 80);
         //jobphoto nézőkép szélessége
         $handle->image_y = round($handle->image_x / $ratio);
         //$handle->image_ratio_y           = true;
         $handle->Process($imagePath);
         if ($handle->processed) {
             //temp file törlése a szerverről
             $handle->clean();
         } else {
             Message::set('error', $handle->error);
             return false;
         }
     } else {
         // Message::set('error', $handle->error);
         return false;
     }
     // ha nincs hiba visszadja a feltöltött kép elérési útját
     return $image_name;
 }
开发者ID:hillmediakft,项目名称:multijob,代码行数:66,代码来源:jobs_model.php

示例12: save

 function save()
 {
     $mainframe = JFactory::getApplication();
     jimport('joomla.filesystem.file');
     require_once JPATH_COMPONENT . DS . 'lib' . DS . 'class.upload.php';
     $row = JTable::getInstance('K2Category', 'Table');
     $params = JComponentHelper::getParams('com_k2');
     if (!$row->bind(JRequest::get('post'))) {
         $mainframe->enqueueMessage($row->getError(), 'error');
         $mainframe->redirect('index.php?option=com_k2&view=categories');
     }
     $isNew = $row->id ? false : true;
     //Trigger the finder before save event
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('finder');
     $results = $dispatcher->trigger('onFinderBeforeSave', array('com_k2.category', $row, $isNew));
     $row->description = JRequest::getVar('description', '', 'post', 'string', 2);
     if ($params->get('xssFiltering')) {
         $filter = new JFilterInput(array(), array(), 1, 1, 0);
         $row->description = $filter->clean($row->description);
     }
     if (!$row->id) {
         $row->ordering = $row->getNextOrder('parent = ' . $row->parent . ' AND trash=0');
     }
     if (!$row->check()) {
         $mainframe->enqueueMessage($row->getError(), 'error');
         $mainframe->redirect('index.php?option=com_k2&view=category&cid=' . $row->id);
     }
     if (!$row->store()) {
         $mainframe->enqueueMessage($row->getError(), 'error');
         $mainframe->redirect('index.php?option=com_k2&view=categories');
     }
     if (!$params->get('disableCompactOrdering')) {
         $row->reorder('parent = ' . $row->parent . ' AND trash=0');
     }
     if ((int) $params->get('imageMemoryLimit')) {
         ini_set('memory_limit', (int) $params->get('imageMemoryLimit') . 'M');
     }
     $files = JRequest::get('files');
     $savepath = JPATH_ROOT . DS . 'media' . DS . 'k2' . DS . 'categories' . DS;
     $existingImage = JRequest::getVar('existingImage');
     if (($files['image']['error'] === 0 || $existingImage) && !JRequest::getBool('del_image')) {
         if ($files['image']['error'] === 0) {
             $image = $files['image'];
         } else {
             $image = JPATH_SITE . DS . JPath::clean($existingImage);
         }
         $handle = new Upload($image);
         if ($handle->uploaded) {
             $handle->file_auto_rename = false;
             $handle->jpeg_quality = $params->get('imagesQuality', '85');
             $handle->file_overwrite = true;
             $handle->file_new_name_body = $row->id;
             $handle->image_resize = true;
             $handle->image_ratio_y = true;
             $handle->image_x = $params->get('catImageWidth', '100');
             $handle->Process($savepath);
             if ($files['image']['error'] === 0) {
                 $handle->Clean();
             }
         } else {
             $mainframe->enqueueMessage($handle->error, 'error');
             $mainframe->redirect('index.php?option=com_k2&view=categories');
         }
         $row->image = $handle->file_dst_name;
     }
     if (JRequest::getBool('del_image')) {
         $currentRow = JTable::getInstance('K2Category', 'Table');
         $currentRow->load($row->id);
         if (JFile::exists(JPATH_ROOT . DS . 'media' . DS . 'k2' . DS . 'categories' . DS . $currentRow->image)) {
             JFile::delete(JPATH_ROOT . DS . 'media' . DS . 'k2' . DS . 'categories' . DS . $currentRow->image);
         }
         $row->image = '';
     }
     if (!$row->store()) {
         $mainframe->enqueueMessage($row->getError(), 'error');
         $mainframe->redirect('index.php?option=com_k2&view=categories');
     }
     //Trigger the finder after save event
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('finder');
     $results = $dispatcher->trigger('onFinderAfterSave', array('com_k2.category', $row, $isNew));
     $cache = JFactory::getCache('com_k2');
     $cache->clean();
     switch (JRequest::getCmd('task')) {
         case 'apply':
             $msg = JText::_('K2_CHANGES_TO_CATEGORY_SAVED');
             $link = 'index.php?option=com_k2&view=category&cid=' . $row->id;
             break;
         case 'saveAndNew':
             $msg = JText::_('K2_CATEGORY_SAVED');
             $link = 'index.php?option=com_k2&view=category';
             break;
         case 'save':
         default:
             $msg = JText::_('K2_CATEGORY_SAVED');
             $link = 'index.php?option=com_k2&view=categories';
             break;
     }
     $mainframe->enqueueMessage($msg);
//.........这里部分代码省略.........
开发者ID:emavro,项目名称:k2,代码行数:101,代码来源:category.php

示例13: Upload

    $product->price_in = $_POST["price_in"];
    $product->price_out = $_POST["price_out"];
    $product->unit = $_POST["unit"];
    $product->description = $_POST["description"];
    $product->presentation = $_POST["presentation"];
    $product->inventary_min = $_POST["inventary_min"];
    $category_id = "NULL";
    if ($_POST["category_id"] != "") {
        $category_id = $_POST["category_id"];
    }
    $is_active = 0;
    if (isset($_POST["is_active"])) {
        $is_active = 1;
    }
    $product->is_active = $is_active;
    $product->category_id = $category_id;
    $product->user_id = Session::getUID();
    $product->update();
    if (isset($_FILES["image"])) {
        $image = new Upload($_FILES["image"]);
        if ($image->uploaded) {
            $image->Process("storage/products/");
            if ($image->processed) {
                $product->image = $image->file_dst_name;
                $product->update_image();
            }
        }
    }
    setcookie("prdupd", "true");
    print "<script>window.location='index.php?view=editproduct&id={$_POST['product_id']}';</script>";
}
开发者ID:leanet,项目名称:inventio-lite,代码行数:31,代码来源:widget-default.php

示例14: Upload

         }
         if (picbigname) {
             @(list($piNameBig, $extbig) = @split("[.]", $final_image_big));
             $final_image_big = $piNameBig . '.' . str_replace($findArray, $replaceArray, $extbig);
         }
         $dir_dest = "../products";
         // we instanciate the class for each element of $file
         $handle = new Upload($_FILES['txtImage_1']);
         // then we check if the file has been uploaded properly
         // in its *temporary* location in the server (often, it is /tmp)
         if ($handle->uploaded) {
             $handle->image_resize = true;
             $handle->image_x = 191;
             $handle->image_y = 183;
             $handle->file_new_name_body = $piName . '_thumb';
             $handle->Process($dir_dest);
             $handle->file_new_name_body = $piName;
             $handle->Process($dir_dest);
             $handle->image_resize = true;
             $handle->image_x = 283;
             $handle->image_y = 269;
             $handle->file_new_name_body = $piNameBig . '_thumb';
             $handle->Process($dir_dest);
             $handle->file_new_name_body = $piNameBig;
             $handle->Process($dir_dest);
         }
         $sql_update = "UPDATE " . $tableprefix . "products SET \n\t\t\t\t\t\t\t product_image_small='" . $final_image_small . "' ,product_image_big ='" . $final_image_big . "'\n\t\t\t\t\t\t\t WHERE product_id =" . $_POST['product'] . "  ";
         $rs_query = mysql_query($sql_update) or die(mysql_error());
     }
 }
 header('Location:list_productview_images_artist.php?msg=Images Added Successfully !!');
开发者ID:kevinsmasters,项目名称:purecatskillsmarketplace,代码行数:31,代码来源:product_viewimages_add_artist.php

示例15: save

 function save()
 {
     $mainframe =& JFactory::getApplication();
     jimport('joomla.filesystem.file');
     require_once JPATH_COMPONENT . DS . 'lib' . DS . 'class.upload.php';
     $row =& JTable::getInstance('K2User', 'Table');
     $params =& JComponentHelper::getParams('com_k2');
     if (!$row->bind(JRequest::get('post'))) {
         $mainframe->redirect('index.php?option=com_k2&view=users', $row->getError(), 'error');
     }
     $row->description = JRequest::getVar('description', '', 'post', 'string', 2);
     if ($params->get('xssFiltering')) {
         $filter = new JFilterInput(array(), array(), 1, 1, 0);
         $row->description = $filter->clean($row->description);
     }
     $jUser =& JFactory::getUser($row->userID);
     $row->userName = $jUser->name;
     if (!$row->store()) {
         $mainframe->redirect('index.php?option=com_k2&view=users', $row->getError(), 'error');
     }
     //Image
     if ((int) $params->get('imageMemoryLimit')) {
         ini_set('memory_limit', (int) $params->get('imageMemoryLimit') . 'M');
     }
     $file = JRequest::get('files');
     $savepath = JPATH_ROOT . DS . 'media' . DS . 'k2' . DS . 'users' . DS;
     if ($file['image']['error'] == 0 && !JRequest::getBool('del_image')) {
         $handle = new Upload($file['image']);
         if ($handle->uploaded) {
             $handle->file_auto_rename = false;
             $handle->file_overwrite = true;
             $handle->file_new_name_body = $row->id;
             $handle->image_resize = true;
             $handle->image_ratio_y = true;
             $handle->image_x = $params->get('userImageWidth', '100');
             $handle->Process($savepath);
             $handle->Clean();
         } else {
             $mainframe->redirect('index.php?option=com_k2&view=users', $handle->error, 'error');
         }
         $row->image = $handle->file_dst_name;
     }
     if (JRequest::getBool('del_image')) {
         $current =& JTable::getInstance('K2User', 'Table');
         $current->load($row->id);
         if (JFile::exists(JPATH_ROOT . DS . 'media' . DS . 'k2' . DS . 'users' . DS . $current->image)) {
             JFile::delete(JPATH_ROOT . DS . 'media' . DS . 'k2' . DS . 'users' . DS . $current->image);
         }
         $row->image = '';
     }
     if (!$row->check()) {
         $mainframe->redirect('index.php?option=com_k2&view=user&cid=' . $row->id, $row->getError(), 'error');
     }
     if (!$row->store()) {
         $mainframe->redirect('index.php?option=com_k2&view=users', $row->getError(), 'error');
     }
     $cache =& JFactory::getCache('com_k2');
     $cache->clean();
     switch (JRequest::getCmd('task')) {
         case 'apply':
             $msg = JText::_('K2_CHANGES_TO_USER_SAVED');
             $link = 'index.php?option=com_k2&view=user&cid=' . $row->userID;
             break;
         case 'save':
         default:
             $msg = JText::_('K2_USER_SAVED');
             $link = 'index.php?option=com_k2&view=users';
             break;
     }
     $mainframe->redirect($link, $msg);
 }
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:71,代码来源:user.php


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