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


PHP Upload::Image方法代码示例

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


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

示例1: uploadImages

function uploadImages($images, $regId)
{
    $Upload = new Upload();
    $regImage = new NcRegImage();
    if (!empty($images)) {
        foreach ($images as $img) {
            if (!empty($img->FILE)) {
                $Title = Check::Name(substr($img->FILE->name, 0, strrpos($img->FILE->name, '.')));
                $FileName = $Title . strrchr($img->FILE->name, '.');
                $Upload->Image((array) $img->FILE);
                unlink($img->FILE->tmp_name);
                $regImage->setImage_name($FileName);
                $regImage->setImage_url($Upload->getResult());
                $regImage->setImage_date(date('Y-m-d H:i:s'));
                $regImage->setReg_id($regId);
                $regImage->Execute()->insert();
            }
        }
    }
}
开发者ID:adrianosilvareis,项目名称:intranet,代码行数:20,代码来源:registro.api.php

示例2: sendCapa

 private function sendCapa($flag)
 {
     if (!empty($this->Data['educando_foto']['tmp_name'])) {
         list($w, $h) = getimagesize($this->Data['educando_foto']['tmp_name']);
         $w = 80;
         //largura da imagem do avatar
         if ($flag) {
             $this->checkCover();
         }
         $Upload = new Upload('uploads/');
         $Upload->Image($this->Data['educando_foto'], $this->Data['educando_nome'], $w, 'educandos');
         if ($Upload->getError()) {
             $this->Error = $Upload->getError();
             $this->Result = false;
         } else {
             $this->Data['educando_foto'] = $Upload->getResult();
             $this->Result = true;
         }
     } else {
         unset($this->Data['educando_foto']);
     }
 }
开发者ID:claytongf,项目名称:patr,代码行数:22,代码来源:AdminEducando.class.php

示例3: sendCapa

 private function sendCapa()
 {
     if (!empty($this->Data['empresa_capa']['tmp_name'])) {
         list($w, $h) = getimagesize($this->Data['empresa_capa']['tmp_name']);
         if ($w != '578' || $h != '288') {
             $_SESSION['errCapa'] = ['Capa Inválida: A Capa da empresa deve ter exatamente 578x288px do tipo .JPG, .PNG ou .GIF!', WS_INFOR];
             $this->Result = false;
             $this->Data['empresa_capa'] = null;
         } else {
             $this->checkCover();
             $Upload = new Upload();
             $Upload->Image($this->Data['empresa_capa'], $this->Data['empresa_name'], 578, 'empresas');
             if ($Upload->getError()) {
                 $this->Error = $Upload->getError();
                 $this->Result = false;
             } else {
                 $this->Data['empresa_capa'] = $Upload->getResult();
                 $this->Result = true;
             }
         }
     }
 }
开发者ID:adrianosilvareis,项目名称:FrameWork_Front,代码行数:22,代码来源:AdminEmpresa.class.php

示例4: Upload

<!DOCTYPE html>
<html lang="pt-br">
    <head>
        <meta charset="UTF-8">
        <title>Helper de gestão de conteúdo</title>
        <link rel="stylesheet" href="css/reset.css" />
    </head>
    <body>
        <?php 
require './_app/Config.inc.php';
$form = filter_input_array(INPUT_POST, FILTER_DEFAULT);
if ($form && $form['SendImage']) {
    $upload = new Upload('uploads/');
    $imagem = $_FILES['image'];
    //            var_dump($imagem);
    $upload->Image($imagem);
    if (!$upload->getResult()) {
        WSErro("Erro ao enviar imágem!<br><small>{$upload->getError()}</small>", WS_ERROR);
    } else {
        WSErro("Imágem enviada com sucesso!<br><small>{$upload->getResult()}</small>", WS_ACCEPT);
    }
    echo '<hr>';
    var_dump($upload);
}
?>

        <form name="fileform" action="" method="post" enctype="multipart/form-data">
            <label>
                <input type="file" name="image"/>
            </label>
            <input type="submit" name="SendImage" value="Enviar arquivo!"/>
开发者ID:BrunoDuarte,项目名称:WS_PHP_ADMIN,代码行数:31,代码来源:06-helper-de-gestao-de-uploads.php

示例5: sendCapa

 private function sendCapa()
 {
     if (!empty($this->Data['user_capa']['tmp_name'])) {
         list($w, $h) = getimagesize($this->Data['user_capa']['tmp_name']);
         $w = 44;
         //largura da imagem do avatar
         $this->checkCover();
         $Upload = new Upload();
         $Upload->Image($this->Data['user_capa'], $this->Data['user_name'], $w, 'users');
         if ($Upload->getError()) {
             $this->Error = $Upload->getError();
             $this->Result = false;
         } else {
             $this->Data['user_capa'] = $Upload->getResult();
             $this->Result = true;
         }
     }
 }
开发者ID:claytongf,项目名称:patr,代码行数:18,代码来源:AdminUser.class.php

示例6: UpdateImage

 private function UpdateImage()
 {
     if (is_array($this->Data['post_cover'])) {
         $WsPosts = new WsPosts();
         $WsPosts->setPost_id($this->Post);
         $WsPosts->Execute()->find();
         $this->deletaImagem('../uploads/' . $WsPosts->Execute()->getResult()->post_cover);
         $upload = new Upload();
         $upload->Image($this->Data['post_cover'], $this->Data['post_name']);
     }
     if (isset($upload) && $upload->getResult()) {
         $this->Data['post_cover'] = $upload->getResult();
         $this->Update();
     } else {
         unset($this->Data['post_cover']);
         if (!empty($upload) && $upload->getError()) {
             WSErro("<b>ERRO AO ENVIAR CAPA: </b>" . $upload->getError(), E_USER_WARNING);
         }
         $this->Update();
     }
 }
开发者ID:adrianosilvareis,项目名称:OutlineTecnolog,代码行数:21,代码来源:AdminPost.class.php

示例7: WSErro

    $empDataGet = array_map('strip_tags', $empDataSet);
    $data = array_map('trim', $empDataGet);
    $data['empresa_capa'] = $_FILES['empresa_capa'];
    if (in_array('', $data) || $data['empresa_capa']['error'] != 0) {
        WSErro("Oppsss: Para cadastrar sua empresa, preencha todos os campos. <b>Tudo é obrigatório aqui!</b> :)", WS_ERROR);
    } else {
        //CADASTRAR EMPRESA... NOME DA CAPA COM EMPRESA_NAME PÓS CAD
        $data['empresa_name'] = Check::Name($data['empresa_title']);
        $data['empresa_date'] = date('Y-m-d H:i:s');
        $empresa = new Controle('app_empresas');
        $empresa->Query("#empresa_title#", "empresa_title={$data['empresa_title']}");
        if ($empresa->getResult()) {
            $data['empresa_name'] = $data['empresa_name'] . '-' . $empresa->getRowCount();
        }
        $sendCapa = new Upload('uploads/');
        $sendCapa->Image($data['empresa_capa'], $data['empresa_name'], 578, 'empresas');
        $data['empresa_capa'] = $sendCapa->getResult();
        $cadastra = $empresa->insert($data);
        if ($cadastra) {
            header('Location: ' . HOME . '/cadastra-empresa/create');
        }
    }
}
?>

        <form name="PostForm" action="" method="post" enctype="multipart/form-data">

            <label class="label">
                <span class="field">Logo da empresa: <sup>Exatamente 578x288px (JPG ou PNG)</sup></span>
                <input type="file" name="empresa_capa" />
            </label>
开发者ID:adrianosilvareis,项目名称:OutlineTecnolog,代码行数:31,代码来源:cadastra-empresa.php

示例8: Upload

switch ($method) {
    case "GET":
        //retorno não implementado
        echo json_encode($request);
        break;
    case "POST":
        //Adiciona arquivo a pasta temporaria
        if (!empty($_FILES['files'])) {
            $gbFiles = Check::ListFiles($_FILES['files']);
            $Upload = new Upload();
            $RESP = array();
            $i = 0;
            foreach ($gbFiles as $File) {
                $Upload->File($File, null, 'temp', 50);
                if ($Upload->getError() && stripos($Upload->getError(), 'image')) {
                    $Upload->Image($File, null, null, 'temp');
                }
                $File['tmp_name'] = BASEDIR . '/uploads/' . $Upload->getResult();
                $RESP[$i]['RESULT'] = HOME . '/uploads/' . $Upload->getResult();
                $RESP[$i]['TYNY'] = HOME . "/tim.php?src=" . $RESP[$i]['RESULT'] . "&w=202&h=105";
                $RESP[$i]['URL'] = $Upload->getResult();
                $RESP[$i]['ERROS'] = $Upload->getError();
                $RESP[$i]['FILE'] = $File;
                $i++;
            }
            if ($Upload->getResult()) {
                echo json_encode($RESP);
            } else {
                echo $Upload->getError();
            }
        }
开发者ID:adrianosilvareis,项目名称:intranet,代码行数:31,代码来源:upload.api.php


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