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


PHP upload::Process方法代码示例

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


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

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

示例2: uploadFile

 /**
  * Efetua upload de arquivos.
  * 
  * @param array $file Arquivo da variável $_FILES['somefile']
  * @param string $where Caminho absoluto para onde salvar o arquivo, ex.: FILES_PATH . '/somewhere'
  * @param string $exitFilename Nome do arquivo no final do processo de upload
  * @param array $allowedExt Lista de extenssoes permitidas para o upload
  * @return \stdClass
  * @throws Exception
  */
 public function uploadFile($file, $where, $exitFilename = null, array $allowedExt = array('jpeg', 'jpg', 'pdf', 'png', 'gif'))
 {
     $result = new \stdClass();
     $result->filename = "";
     $result->pathAndFilename = "";
     $result->fileExt = "";
     $upload = new \upload($file);
     if ($upload->uploaded) {
         // Formatos Aceitos (Extensoes)
         if (in_array($upload->file_src_name_ext, $allowedExt)) {
             // Formatos Aceitos (Mimetypes)
             $upload->allowed = array('image/jpg', 'image/pjpeg', 'image/jpeg', 'image/png', 'image/gif', 'application/x-zip-compressed', 'application/pdf', 'application/download', 'application/applefile');
             $upload->Process($where);
             // Upload deu tudo certo?
             if ($upload->processed) {
                 // Define resultado
                 $result->fileExt = $upload->file_src_name_ext;
                 $result->filename = $upload->file_dst_name;
                 $result->pathAndFilename = $where . $upload->file_dst_name;
                 // Permissao total no arquivo
                 chmod($result->pathAndFilename, 0777);
                 // Se for para mudar o nome do arquivo de saida
                 if ($exitFilename) {
                     // Renomeia
                     if (!rename($result->pathAndFilename, $where . $exitFilename . '.' . $upload->file_src_name_ext)) {
                         throw new Exception("Não foi possível mover o arquivo '{$result->pathAndFilename}'");
                     }
                     $result->filename = $exitFilename . '.' . $upload->file_src_name_ext;
                     $result->pathAndFilename = $where . $exitFilename . '.' . $upload->file_src_name_ext;
                 }
             } else {
                 throw new \Exception($upload->error);
             }
         } else {
             throw new \Exception("Extenssão inválida");
         }
     } else {
         throw new \Exception($upload->error);
     }
     return $result;
 }
开发者ID:marcobraghim,项目名称:sni,代码行数:51,代码来源:MvcAbstractController.php

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

示例4: updateConfigEmpreendimento

 public static function updateConfigEmpreendimento()
 {
     $EmpreendimentoTO = new EmpreendimentoTO();
     $EmpreendimentoDao = new EmpreendimentoDao();
     $EmpreendimentoTO->id = isset($_POST['id']) ? $_POST['id'] : NULL;
     $EmpreendimentoTO->nome_empreendimento = isset($_POST['nome_empreendimento']) ? $_POST['nome_empreendimento'] : NULL;
     $EmpreendimentoTO->nickname = isset($_POST['nickname']) ? $_POST['nickname'] : NULL;
     $EmpreendimentoTO->dsc_empreendimento = isset($_POST['dsc_empreendimento']) ? $_POST['dsc_empreendimento'] : NULL;
     $EmpreendimentoTO->url_facebook = isset($_POST['url_facebook']) ? $_POST['url_facebook'] : NULL;
     $EmpreendimentoTO->url_twitter = isset($_POST['url_twitter']) ? $_POST['url_twitter'] : NULL;
     $EmpreendimentoTO->url_google_plus = isset($_POST['url_google_plus']) ? $_POST['url_google_plus'] : NULL;
     $EmpreendimentoTO->url_linkedin = isset($_POST['url_linkedin']) ? $_POST['url_linkedin'] : NULL;
     $EmpreendimentoTO->url_pinterest = isset($_POST['url_pinterest']) ? $_POST['url_pinterest'] : NULL;
     $EmpreendimentoTO->nme_logo = isset($_POST['nme_logo']) ? $_POST['nme_logo'] : NULL;
     $EmpreendimentoTO->end_email_contato = isset($_POST['end_email_contato']) ? $_POST['end_email_contato'] : NULL;
     $EmpreendimentoTO->num_telefone = isset($_POST['num_telefone']) ? $_POST['num_telefone'] : NULL;
     $EmpreendimentoTO->num_cnpj = isset($_POST['num_cnpj']) ? $_POST['num_cnpj'] : NULL;
     $EmpreendimentoTO->num_inscricao_estadual = isset($_POST['num_inscricao_estadual']) ? $_POST['num_inscricao_estadual'] : NULL;
     $EmpreendimentoTO->num_inscricao_municipal = isset($_POST['num_inscricao_municipal']) ? $_POST['num_inscricao_municipal'] : NULL;
     $EmpreendimentoTO->nme_razao_social = isset($_POST['nme_razao_social']) ? $_POST['nme_razao_social'] : NULL;
     $EmpreendimentoTO->nme_fantasia = isset($_POST['nme_fantasia']) ? $_POST['nme_fantasia'] : NULL;
     $EmpreendimentoTO->num_cep = isset($_POST['num_cep']) ? $_POST['num_cep'] : NULL;
     $EmpreendimentoTO->nme_logradouro = isset($_POST['nme_logradouro']) ? $_POST['nme_logradouro'] : NULL;
     $EmpreendimentoTO->num_logradouro = isset($_POST['num_logradouro']) ? $_POST['num_logradouro'] : NULL;
     $EmpreendimentoTO->nme_bairro_logradouro = isset($_POST['nme_bairro_logradouro']) ? $_POST['nme_bairro_logradouro'] : NULL;
     $EmpreendimentoTO->cod_estado = isset($_POST['cod_estado']) ? $_POST['cod_estado'] : NULL;
     $EmpreendimentoTO->cod_cidade = isset($_POST['cod_cidade']) ? $_POST['cod_cidade'] : NULL;
     $EmpreendimentoTO->num_percentual_credito_simples = isset($_POST['num_percentual_credito_simples']) ? $_POST['num_percentual_credito_simples'] : NULL;
     $EmpreendimentoTO->flg_contribuinte_icms = isset($_POST['flg_contribuinte_icms']) ? (int) $_POST['flg_contribuinte_icms'] : NULL;
     $EmpreendimentoTO->flg_contribuinte_ipi = isset($_POST['flg_contribuinte_ipi']) ? (int) $_POST['flg_contribuinte_ipi'] : NULL;
     $EmpreendimentoTO->num_inscricao_estadual_st = isset($_POST['num_inscricao_estadual_st']) ? $_POST['num_inscricao_estadual_st'] : NULL;
     $EmpreendimentoTO->cod_regime_tributario = isset($_POST['cod_regime_tributario']) && is_numeric($_POST['cod_regime_tributario']) ? $_POST['cod_regime_tributario'] : NULL;
     $EmpreendimentoTO->cod_regime_pis_cofins = isset($_POST['cod_regime_pis_cofins']) && is_numeric($_POST['cod_regime_pis_cofins']) ? $_POST['cod_regime_pis_cofins'] : NULL;
     $EmpreendimentoTO->cod_tipo_empresa = isset($_POST['cod_tipo_empresa']) && is_numeric($_POST['cod_tipo_empresa']) ? $_POST['cod_tipo_empresa'] : NULL;
     $EmpreendimentoTO->cod_zoneamento = isset($_POST['cod_zoneamento']) && is_numeric($_POST['cod_zoneamento']) ? $_POST['cod_zoneamento'] : NULL;
     $Validator = new DataValidator();
     $Validator->set_msg('O nome do empreendimento é obrigatório')->set('nome_empreendimento', $EmpreendimentoTO->nome_empreendimento)->is_required();
     $Validator->set_msg('O ID do empreendimento é obrigatório')->set('id', $EmpreendimentoTO->id)->is_required();
     $Validator->set_msg('O nickname do empreendimento é obrigatório')->set('nickname', $EmpreendimentoTO->nickname)->is_required();
     if (isset($_FILES['nme_logo'])) {
         $status_upload = false;
         $handle = new upload($_FILES['nme_logo']);
         $handle->allowed = array('image/jpeg', 'image/jpg', 'image/gif', 'image/png');
         list($width, $height) = getimagesize($_FILES['nme_logo']['tmp_name']);
         if (!($width >= 118 && $height >= 36)) {
             $Validator->_errors['nme_logo'][] = 'O Tamanho da imagem deve ser igual ou superior a 118x36. Está imagem tem ' . $width . "x" . $height;
         } else {
             if ($handle->uploaded) {
                 $handle->Process(CAMINHO_UPLOAD_IMG_LOGO);
                 if ($handle->processed) {
                     $status_upload = true;
                     $EmpreendimentoTO->nme_logo = $handle->file_dst_name;
                 }
             }
             if (!$status_upload) {
                 if ($handle->error == 'Incorrect type of file') {
                     $Validator->_errors['nme_logo'][] = 'O formato da imagem deve ser jpeg, jpg ou gif';
                 } else {
                     Flight::halt(500, 'Ocorreu um erro ao fazer o upload da imagem ' . $handle->error);
                 }
             }
         }
     }
     if (!$Validator->validate()) {
         Flight::response()->status(406)->header('Content-Type', 'application/json')->write(json_encode($Validator->get_errors()))->send();
         return;
     }
     if ($EmpreendimentoDao->updateConfigEmpreendimento($EmpreendimentoTO)) {
         $inscricoes_estaduais = isset($_POST['inscricoes_estaduais']) ? $_POST['inscricoes_estaduais'] : array();
         $ids_not_delete = array();
         foreach ($inscricoes_estaduais as $key => $value) {
             $InscricaoEstadualDao = new InscricaoEstadualDao();
             $InscricaoEstadual = new stdClass();
             $InscricaoEstadual->id_empreendimento = $value['id_empreendimento'];
             $InscricaoEstadual->num_inscricao_estadual = $value['num_inscricao_estadual'];
             $InscricaoEstadual->num_inscricao_estadual_st = $value['num_inscricao_estadual_st'];
             $InscricaoEstadual->uf = $value['uf'];
             if (!(isset($value['id']) && $value['id'])) {
                 $InscricaoEstadualTO = new InscricaoEstadualTO();
                 $InscricaoEstadualTO->__setAll($value);
                 $ids_not_delete[] = $InscricaoEstadualDao->save($InscricaoEstadualTO);
             } else {
                 $ids_not_delete[] = $value['id'];
                 $InscricaoEstadualDao->updateInscricao($InscricaoEstadual, 'id=' . $value['id']);
             }
         }
         $InscricaoEstadualDao->deleteInscricao('id_empreendimento = ' . $EmpreendimentoTO->id . ' AND id NOT IN(' . join(',', $ids_not_delete) . ')');
         Flight::halt(200);
     } else {
         Flight::halt(500, 'erro ao atualizar empreendimento');
     }
 }
开发者ID:filipecoelho,项目名称:webliniaerp-api,代码行数:92,代码来源:EmpreendimentoController.php

示例5: updateProduto


//.........这里部分代码省略.........
     		  ->set('id_categoria',$ProdutoTO->id_categoria)
     		  ->is_required();
     
     $validator->set_msg('A quantidade minina do produto é obrigatório')
     		  ->set('qtd_minima_estoque',$ProdutoTO->qtd_minima_estoque)
     		  ->is_required();
     
     if(!(isset($fornecedores) && is_array($fornecedores) && count($fornecedores) > 0)){
     	$validator->_errors['fornecedores'][] = 'É obrigatório informar pelo menos um fornecedor';
     }
     
     
     $preco['vlr_custo']                = isset($preco['vlr_custo'])                ?  $preco['vlr_custo']                : 0 ;
     $preco['perc_imposto_compra']      = isset($preco['perc_imposto_compra'])      ?  $preco['perc_imposto_compra']      : 0 ;
     $preco['perc_desconto_compra']     = isset($preco['perc_desconto_compra'])     ?  $preco['perc_desconto_compra']     : 0 ;
     $preco['perc_venda_atacado']       = isset($preco['perc_venda_atacado'])       ?  $preco['perc_venda_atacado']       : 0 ;
     $preco['perc_venda_varejo']        = isset($preco['perc_venda_varejo'])        ?  $preco['perc_venda_varejo']        : 0 ;
     $preco['perc_venda_intermediario'] = isset($preco['perc_venda_intermediario']) ?  $preco['perc_venda_intermediario'] : 0 ;
     
     $validator->set_msg('O valor de tabela é obrigatório')
     		  ->set('vlr_custo',$preco['vlr_custo'])
     		  ->is_required();
     */
     if (!(isset($empreendimentos) && is_array($empreendimentos) && count($empreendimentos) > 0)) {
         $validator->_errors['empreendimentos'][] = 'É obrigatório vincular o produto pelo menos a um empreendimento';
     }
     $new_image = false;
     if (isset($_FILES['img'])) {
         $ProdutoTO->img = NULL;
         $status_upload = false;
         $handle = new upload($_FILES['img']);
         $handle->allowed = array('image/jpeg', 'image/jpg');
         if ($handle->uploaded) {
             $handle->Process(CAMINHO_UPLOAD_IMG_PRODUTO);
             if ($handle->processed) {
                 $status_upload = true;
                 $ProdutoTO->img = $handle->file_dst_name;
                 $new_image = CAMINHO_UPLOAD_IMG_PRODUTO . $handle->file_dst_name;
             }
         }
         if (!$status_upload) {
             if ($handle->error == 'Incorrect type of file') {
                 $validator->_errors['img'][] = 'O formato da imagem deve ser jpeg ou jpg';
             } else {
                 Flight::halt(500, 'Ocorreu um erro ao fazer o upload da imagem ' . $handle->error);
             }
         }
     }
     $ProdutoTO->nme_arquivo_nutricional = NULL;
     if (isset($_FILES['arquivo-produto'])) {
         $status_upload_file = false;
         $handle = new upload($_FILES['arquivo-produto']);
         if ($handle->uploaded) {
             $handle->Process(CAMINHO_UPLOAD_FILE_PRODUTO);
             if ($handle->processed) {
                 $status_upload_file = true;
                 $ProdutoTO->nme_arquivo_nutricional = $handle->file_dst_name;
             }
         }
         if (!$status_upload_file) {
             Flight::halt(500, 'Ocorreu um erro ao fazer o upload do arquivo nutricional' . $handle->error);
         }
     }
     if (!$validator->validate()) {
         Flight::response()->status(406)->header('Content-Type', 'application/json')->write(json_encode($validator->get_errors()))->send();
         return;
开发者ID:filipecoelho,项目名称:webliniaerp-api,代码行数:67,代码来源:ProdutoController.php

示例6: saveFile

 /**
  * */
 public function saveFile($file, $file_name)
 {
     $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 = $file_name;
         // It could be something like $upload->Process('www/my_uploads/');
         $upload->Process($rep_dest);
         //$upload->clean();
         return $upload->file_dst_name;
     }
     return null;
 }
开发者ID:aurellemeless,项目名称:favoris,代码行数:18,代码来源:importer.classic.php

示例7: upload

			<div style="float: left">
				<input type="submit" id="insert" name="insert" value="{#insert}" onclick="ImageDialog.insert();return false;" />
			</div>

			<div style="float: right">
				<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
			</div>
		</div>
</form>
<?php 
include './classes/class.upload.php';
if (isset($_POST['action']) && $_POST['action'] == 'image') {
    include './config.php';
    $handle = new upload($_FILES['image_field'], $language);
    include './config.php';
    $handle->Process($server_image_directory);
    if ($handle->uploaded) {
        if ($handle->processed) {
            echo "<script>setTimeout(\"document.getElementById('src').value='" . $url_image_directory . "/" . $handle->file_dst_name . "'\", 200)</script>";
            echo "<script>setTimeout(\"ImageDialog.showPreviewImage(document.getElementById('src').value)\", 400)</script>";
        } else {
            $error_str = str_replace("'", "`", $handle->error);
            echo "<script>alert('{$error_str}')</script>";
        }
        $handle->Clean();
    } else {
        $error_str = str_replace("'", "`", $handle->error);
        echo "<script>alert('{$error_str}')</script>";
    }
}
?>
开发者ID:nkuitse,项目名称:Guide-on-the-Side,代码行数:31,代码来源:image.php

示例8: saveImage

 function saveImage($imagepath)
 {
     $imagepath = trim($imagepath);
     if (isset($this->_k2_item_id) && is_int($this->_k2_item_id) && $this->_k2_item_id > 0) {
         //echo JPATH_ADMINISTRATOR .DS."components".DS."com_k2".DS.'lib'.DS.'class.upload.php';
         //die();
         require_once JPATH_ADMINISTRATOR . DS . "components" . DS . "com_k2" . DS . 'lib' . DS . 'class.upload.php';
         $image = JPATH_SITE . DS . JPath::clean($imagepath);
         $handle = new upload($image);
         $handle->allowed = array('image/*');
         $params =& JComponentHelper::getParams('com_k2');
         if ($handle->uploaded) {
             //Original image
             $savepath = JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'src';
             $handle->image_convert = 'jpg';
             $handle->jpeg_quality = 100;
             $handle->file_auto_rename = false;
             $handle->file_overwrite = true;
             $handle->file_new_name_body = md5("Image" . $this->_k2_item_id);
             $handle->Process($savepath);
             $filename = $handle->file_dst_name_body;
             $savepath = JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache';
             //XLarge image
             $handle->image_resize = true;
             $handle->image_ratio_y = true;
             $handle->image_convert = 'jpg';
             $handle->jpeg_quality = $params->get('imagesQuality');
             $handle->file_auto_rename = false;
             $handle->file_overwrite = true;
             $handle->file_new_name_body = $filename . '_XL';
             if (JRequest::getInt('itemImageXL')) {
                 $imageWidth = JRequest::getInt('itemImageXL');
             } else {
                 $imageWidth = $params->get('itemImageXL', '800');
             }
             $handle->image_x = $imageWidth;
             $handle->Process($savepath);
             //Large image
             $handle->image_resize = true;
             $handle->image_ratio_y = true;
             $handle->image_convert = 'jpg';
             $handle->jpeg_quality = $params->get('imagesQuality');
             $handle->file_auto_rename = false;
             $handle->file_overwrite = true;
             $handle->file_new_name_body = $filename . '_L';
             if (JRequest::getInt('itemImageL')) {
                 $imageWidth = JRequest::getInt('itemImageL');
             } else {
                 $imageWidth = $params->get('itemImageL', '600');
             }
             $handle->image_x = $imageWidth;
             $handle->Process($savepath);
             //Medium image
             $handle->image_resize = true;
             $handle->image_ratio_y = true;
             $handle->image_convert = 'jpg';
             $handle->jpeg_quality = $params->get('imagesQuality');
             $handle->file_auto_rename = false;
             $handle->file_overwrite = true;
             $handle->file_new_name_body = $filename . '_M';
             if (JRequest::getInt('itemImageM')) {
                 $imageWidth = JRequest::getInt('itemImageM');
             } else {
                 $imageWidth = $params->get('itemImageM', '400');
             }
             $handle->image_x = $imageWidth;
             $handle->Process($savepath);
             //Small image
             $handle->image_resize = true;
             $handle->image_ratio_y = true;
             $handle->image_convert = 'jpg';
             $handle->jpeg_quality = $params->get('imagesQuality');
             $handle->file_auto_rename = false;
             $handle->file_overwrite = true;
             $handle->file_new_name_body = $filename . '_S';
             if (JRequest::getInt('itemImageS')) {
                 $imageWidth = JRequest::getInt('itemImageS');
             } else {
                 $imageWidth = $params->get('itemImageS', '200');
             }
             $handle->image_x = $imageWidth;
             $handle->Process($savepath);
             //XSmall image
             $handle->image_resize = true;
             $handle->image_ratio_y = true;
             $handle->image_convert = 'jpg';
             $handle->jpeg_quality = $params->get('imagesQuality');
             $handle->file_auto_rename = false;
             $handle->file_overwrite = true;
             $handle->file_new_name_body = $filename . '_XS';
             if (JRequest::getInt('itemImageXS')) {
                 $imageWidth = JRequest::getInt('itemImageXS');
             } else {
                 $imageWidth = $params->get('itemImageXS', '100');
             }
             $handle->image_x = $imageWidth;
             $handle->Process($savepath);
             //Generic image
             $handle->image_resize = true;
             $handle->image_ratio_y = true;
//.........这里部分代码省略.........
开发者ID:Gskflute,项目名称:joomla25,代码行数:101,代码来源:k2import.php

示例9: list

 list($intOriginalWidth, $intOriginalHeight) = getimagesize($handle->file_src_pathname);
 //set a min width
 $handle->image_min_width = $headshot_large_width;
 $handle->image_x = $intOriginalWidth;
 $handle->file_new_name_body = 'headshot_original';
 $lboolResize = TRUE;
 $handle->image_resize = true;
 $handle->image_ratio_y = true;
 $handle->image_convert = 'jpg';
 $handle->file_overwrite = true;
 $handle->file_auto_rename = false;
 $handle->dir_auto_chmod = true;
 // now, we start the upload 'process'. That is, to copy the uploaded file
 // from its temporary location to the wanted location
 // It could be something like $handle->Process('/home/www/my_uploads/');
 $handle->Process($dir_dest);
 // we check if everything went OK
 if ($handle->processed) {
     //if resize is true, large was uploaded so resize and create 2 thumbnails
     //if resize is false, print error
     if ($lboolResize) {
         list($width, $height) = getimagesize($dir_dest . DIRECTORY_SEPARATOR . "headshot_original.jpg");
         $rscThumbnail = imagecreatetruecolor($headshot_thumb_width, $headshot_thumb_width);
         $rscLargeImage = imagecreatetruecolor($headshot_large_width, $headshot_large_width);
         $rscOriginalImage = imagecreatefromjpeg($dir_dest . DIRECTORY_SEPARATOR . "headshot_original.jpg");
         imagecopyresampled($rscThumbnail, $rscOriginalImage, 0, 0, 0, 0, $headshot_thumb_width, $headshot_thumb_width, $width, $height);
         imagecopyresampled($rscLargeImage, $rscOriginalImage, 0, 0, 0, 0, $headshot_large_width, $headshot_large_width, $width, $height);
         imagejpeg($rscThumbnail, $dir_dest . DIRECTORY_SEPARATOR . "headshot.jpg");
         imagejpeg($rscLargeImage, $dir_dest . DIRECTORY_SEPARATOR . "headshot_large.jpg");
     }
     // everything was fine ! Close the modal window and reload page to show changes
开发者ID:johnwinsor,项目名称:SubjectsPlus,代码行数:31,代码来源:set_picture.php

示例10:

 //$foo->file_overwrite		= true;
 //$foo->image_convert 		= 'jpg';
 //$foo->image_resize			= false;
 //$foo->Process("$img_dst_source/{$a['id']}");
 //if (!$foo->processed) {
 //	echo 'error : ' . $foo->error;
 //}
 ////chmod("$img_dst_source/{$a['id']}/{$foo->file_dst_name}", 0755);
 $foo->file_overwrite = true;
 $foo->image_convert = 'jpg';
 $foo->image_resize = true;
 $foo->image_ratio_crop = false;
 $foo->image_ratio = true;
 $foo->image_x = 600;
 $foo->image_y = 400;
 $foo->Process("{$img_dst_large}/{$a['id']}");
 if (!$foo->processed) {
     echo 'error : ' . $foo->error;
 }
 //chmod("$img_web_large/{$a['id']}/{$foo->file_dst_name}", 0755);
 echo "<p><img src='{$img_web_large}/{$a['id']}/{$foo->file_dst_name}' /></p>";
 $foo->file_overwrite = true;
 $foo->image_convert = 'jpg';
 $foo->image_resize = true;
 $foo->image_ratio = false;
 $foo->image_ratio_crop = true;
 $foo->image_y = 125;
 $foo->image_x = 125;
 $foo->Process("{$img_dst_thumb}/{$a['id']}");
 if (!$foo->processed) {
     echo 'error : ' . $foo->error;
开发者ID:heathervreeland,项目名称:Occasions-Online-WP-Theme,代码行数:31,代码来源:profile.php

示例11: upload

                }
                $img->dir_auto_create = true;
                $img->image_x = $size_x;
                $img->image_y = $size_y;
                $img->process($cache_dir . $size . '/');
                // Вывод ошибок и очистка
                if ($img->processed) {
                    $img->clean();
                } else {
                    echo 'error : ' . $img->error;
                }
                $image_name = Text::strtolow(str_replace(' ', '_', $image_name));
                $image_name = str_replace('(', '', $image_name);
                $image_name = str_replace(')', '', $image_name);
                // Получаем изображение из кэша
                $img = new upload($cache_dir . $size . '/' . $image_name);
                // Вывод изображения
                header('Content-type: ' . $img->file_src_mime);
                echo $img->Process();
                exit;
            }
        }
    } else {
        $img = new upload($dir . $image_name);
        // Вывод оригинального изображения
        header('Content-type: ' . $img->file_src_mime);
        echo $img->Process();
        exit;
    }
}
exit;
开发者ID:klimjr,项目名称:cms,代码行数:31,代码来源:index.action.php

示例12: unlink

        $foo->file_new_name_body = 'logo';
        $foo->file_new_name_ext = 'jpg';
        $foo->file_overwrite = true;
        $foo->file_auto_rename = false;
        $foo->auto_create_dir = false;
        $foo->dir_auto_chmod = false;
        $foo->dir_chmod = 0755;
        $foo->image_convert = 'jpg';
        $foo->file_safe_name = false;
        $foo->jpeg_quality = 85;
        $foo->mime_check = false;
        $foo->image_resize = true;
        $foo->image_ratio_crop = true;
        $foo->image_y = 125;
        $foo->image_x = 125;
        $foo->Process("{$img_dst_logo}/{$pid}/");
        if (!$foo->processed) {
            file_put_contents("{$img_dst_logosource}/{$pid}/{$file_name}.log", $foo->error, FILE_APPEND);
            //echo 'ERROR ON LOGO THUMBNAIL: ' . $foo->error;
            //exit(0);
        }
        unlink("{$img_dst_logosource}/{$pid}/{$file_name}");
        echo '1';
        exit;
    }
}
if (isset($get['cmd']) && $get['cmd'] == 'upload_videos') {
    if (!empty($_FILES)) {
        // first make our directory
        if (!is_dir("{$img_dst_video}/{$pid}")) {
            mkdir("{$img_dst_video}/{$pid}", 0755);
开发者ID:heathervreeland,项目名称:Occasions-Online-WP-Theme,代码行数:31,代码来源:doimage.php

示例13: FStr

}
/**
 * Simplify using filters for STRINGS
 * @param $x
 * @return mixed
 */
function FStr($x)
{
    return filter_var($x, FILTER_SANITIZE_SPECIAL_CHARS);
}
/**
 * UPLOADING IMAGES
 * NEEDS THIS CLASS : https://github.com/verot/class.upload.php
 */
$Upload = new upload($_FILES["bannerupload"]);
if ($Upload->uploaded) {
    $Upload->Process("../IMG/bannersystem/");
    if ($Upload->processed) {
        /**
         * PUT MORE CODE HERE - HERE IS WHEN ALL GOES WELL
         */
        $FileName = $Upload->file_dst_name;
        $Upload->clean();
    } else {
        echo 'error : ' . $Upload->error;
    }
} else {
    echo 'error : ' . $Upload->error;
    echo "<br><br>";
    echo "LOG: " . $Upload->log;
}
开发者ID:jom006,项目名称:snippets,代码行数:31,代码来源:functions.php

示例14: upload

			<div style="float: left">
				<input type="submit" id="insert" name="insert" value="{#insert}" onclick="ImageDialog.insert();return false;" />
			</div>

			<div style="float: right">
				<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
			</div>
		</div>
</form>
<?php 
include './classes/class.upload.php';
if (isset($_POST['action']) && $_POST['action'] == 'image') {
    $handle = new upload($_FILES['image_field'], $language);
    include './config.php';
    if ($handle->image_resize === true) {
        $handle->Process($server_thumbnail_directory);
        $thumbnail_path = $url_thumbnail_directory . DIRECTORY_SEPARATOR . $handle->file_dst_name;
        $handle->image_resize = false;
        $handle->Process($server_image_directory);
        $image_path = $url_image_directory . DIRECTORY_SEPARATOR . $handle->file_dst_name;
    } else {
        $handle->Process($server_image_directory);
        $path = $url_image_directory . DIRECTORY_SEPARATOR . $handle->file_dst_name;
    }
    if ($handle->uploaded) {
        if ($handle->processed) {
            echo "<script>setTimeout(\"document.getElementById('src').value='{$thumbnail_path}'\", 200)</script>";
            echo "<script>setTimeout(\"document.getElementById('original_src').value='{$image_path}'\", 400)</script>";
            echo "<script>setTimeout(\"ImageDialog.showPreviewImage(document.getElementById('src').value)\", 600)</script>";
        } else {
            $error_str = str_replace("'", "`", $handle->error);
开发者ID:asadaqain,项目名称:Guide-on-the-Side,代码行数:31,代码来源:image.php

示例15: downloadImage

 public static function downloadImage($url, $params)
 {
     $cacheTime = $params->get('feedcache', 60);
     $imgcheckmime = (int) $params->get('checkmime', 1);
     $url = str_replace(" ", "%20", JString::trim($url));
     if (!$params->get('storeimages', 0) || !$cacheTime || JString::strlen($url) < 6 || JString::substr($url, 0, 4) != "http") {
         return $url;
     }
     $ext = JString::strtolower(end(explode('.', $url, 2)));
     if (empty($ext)) {
         $ext = 'jpg';
     }
     $valid_ext = array('png', 'jpg', 'jpeg', 'gif', 'bmp', 'ico');
     if ($imgcheckmime && !in_array($ext, $valid_ext)) {
         return $url;
     }
     $cachePath = JPATH_SITE . DS . 'cache' . DS . 'mod_we_ufeed_display';
     $cacheTime = $cacheTime * 60;
     //to seconds
     $filename = JFile::makeSafe(md5($url) . "." . $ext);
     if (!JFolder::exists($cachePath)) {
         JFolder::create($cachePath);
     }
     if (JFile::exists($cachePath . DS . $filename)) {
         if (time() < filemtime($cachePath . DS . $filename) + $cacheTime && is_readable($cachePath . DS . $filename)) {
             return JString::trim(JURI::root(true) . '/cache/mod_we_ufeed_display/' . $filename);
         } else {
             JFile::delete($cachePath . DS . $filename);
         }
     }
     $buffer = "";
     if (in_array('curl', get_loaded_extensions()) && !@ini_get('safe_mode')) {
         $ch = curl_init();
         // cURL
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_HEADER, 0);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
         $buffer = @curl_exec($ch);
         curl_close($ch);
     } elseif (empty($buffer) && @ini_get('allow_url_fopen')) {
         $buffer = @file_get_contents($url);
     }
     $img = $url;
     if (!empty($buffer) && JFile::write($cachePath . DS . $filename, $buffer) && filesize($cachePath . DS . $filename) > 999) {
         $img = JURI::root(true) . '/cache/mod_we_ufeed_display/' . $filename;
         $stored = true;
     } else {
         $img = $url;
         if (JFile::exists($cachePath . DS . $filename)) {
             JFile::delete($cachePath . DS . $filename);
         }
     }
     $allowResize = false;
     if ($allowResize && $stored && $cropImages) {
         if (!class_exists('upload')) {
             require_once dirname(__FILE__) . DS . 'resizer.php';
         }
         $handle = new upload($cachePath . DS . $filename);
         $handle->image_resize = true;
         $handle->image_ratio_y = true;
         $handle->image_convert = 'jpg';
         $handle->jpeg_quality = $params->get('imagesQuality', 100);
         $handle->file_auto_rename = false;
         $handle->file_overwrite = true;
         $handle->file_new_name_body = $filename;
         $handle->image_x = $params->get('resizewidth', '150');
         $handle->Process($cachePath);
         $handle->Clean();
     }
     return $img;
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:73,代码来源:helper.php


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