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


PHP upload::resize方法代码示例

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


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

示例1: upload

function upload($image)
{
    include "upload.inc.php";
    // Defining Class
    $yukle = new upload();
    // Set Max Size
    $yukle->set_max_size(180000);
    // Set Directory
    $yukle->set_directory("/home/jimgreen/public_html/images/" . $image . "");
    // Do not change
    // Set Temp Name for upload, $_FILES['file']['tmp_name'] is automaticly get the temp name
    $yukle->set_tmp_name($_FILES['file']['tmp_name']);
    // Do not change
    // Set file size, $_FILES['file']['size'] is automaticly get the size
    $yukle->set_file_size($_FILES['file']['size']);
    // Do not change
    // Set File Type, $_FILES['file']['type'] is automaticly get the type
    $yukle->set_file_type($_FILES['file']['type']);
    // Set File Name, $_FILES['file']['name'] is automaticly get the file name.. you can change
    $yukle->set_file_name($_FILES['file']['name']);
    // Start Copy Process
    $yukle->start_copy();
    // If uploaded file is image, you can resize the image width and height
    // Support gif, jpg, png
    $yukle->resize(218, 218);
    // Control File is uploaded or not
    // If there is error write the error message
    if ($yukle->is_ok()) {
        echo "ok";
    } else {
        echo $yukle->error() . "<br>";
    }
    // Set a thumbnail name
    $yukle->set_thumbnail_name("thumb1");
    // create thumbnail
    $yukle->create_thumbnail();
    // change thumbnail size
    $yukle->set_thumbnail_size(0, 250);
    $yukle->set_thumbnail_name("thumb2");
    $yukle->create_thumbnail();
    $yukle->set_thumbnail_size(50, 0);
    $yukle->set_thumbnail_name("thumb3");
    $yukle->create_thumbnail();
    $yukle->set_thumbnail_size(62, 150);
}
开发者ID:jasmith152,项目名称:Green_Jewelers,代码行数:45,代码来源:upload.php

示例2: upload

$vendedor = $_POST['vendedor'];
if ($_FILES['logo']['name'] != "") {
    include_once '../resources/class.upload.php';
    $yukle = new upload();
    $yukle->set_max_size(99999999);
    $yukle->set_directory('../../images-clientes');
    $yukle->set_tmp_name($_FILES['logo']['tmp_name']);
    $yukle->set_file_size($_FILES['logo']['size']);
    $yukle->set_file_type($_FILES['logo']['type']);
    //random
    $random = substr(md5(rand()), 0, 6);
    $avatarname = $random . '_' . $_FILES['logo']['name'];
    $nombre_final = str_replace(' ', '-', $avatarname);
    $yukle->set_file_name($nombre_final);
    $yukle->start_copy();
    $yukle->resize(620, 0);
    $yukle->set_thumbnail_name('tn_' . $nombre_final);
    $yukle->create_thumbnail();
    $yukle->set_thumbnail_size(300, 0);
    if ($yukle->is_ok()) {
        $logo = $nombre_final;
    } else {
        //si hay error cargo sin imagen
        $logo = "";
    }
}
/* INSERT */
include_once "classes/class.usuarios.php";
$usuarios = new usuarios();
$usuarios->idUsuario = $idUsuario;
$usuarios->strNombre = $strNombre;
开发者ID:EzequielDot175,项目名称:nufarm,代码行数:31,代码来源:c_usuario.php

示例3: upload_file

 public function upload_file()
 {
     //1 = OK - 0 = Failure
     $file = array('status' => '', 'filename' => '', 'msg' => '');
     //check ext.
     $file_extensions_allowed = array('image/gif', 'image/png', 'image/jpeg', 'image/jpg');
     $exts_humano = array('gif', 'png', 'jpeg', 'jpg');
     $exts_humano = implode(', ', $exts_humano);
     $ext = $_FILES['filename']['type'];
     #$ext = strtolower($ext);
     if (!in_array($ext, $file_extensions_allowed)) {
         $exts = implode(', ', $file_extensions_allowed);
         $file['msg'] .= "<p>" . $_FILES['filename']['name'] . " <br />Puede subir archivos que tengan alguna de estas extenciones: " . $exts_humano . "</p>";
     } else {
         include APPPATH . 'libraries/class.upload.php';
         $yukle = new upload();
         $yukle->set_max_size(1900000);
         $yukle->set_directory('./images-productos');
         $yukle->set_tmp_name($_FILES['filename']['tmp_name']);
         $yukle->set_file_size($_FILES['filename']['size']);
         $yukle->set_file_type($_FILES['filename']['type']);
         $random = substr(md5(rand()), 0, 6);
         $name_whitout_whitespaces = str_replace(" ", "-", $_FILES['filename']['name']);
         $imagname = '' . $random . '_' . $name_whitout_whitespaces;
         #$thumbname='tn_'.$imagname;
         $yukle->set_file_name($imagname);
         $yukle->start_copy();
         if ($yukle->is_ok()) {
             if (count($this->data['thumbnail_sizes'])) {
                 foreach ($this->data['thumbnail_sizes'] as $thumb_size) {
                     //create thumbnail
                     $yukle->resize(1000, 0);
                     $yukle->set_thumbnail_name('tn_' . $thumb_size . '_' . $imagname);
                     $result_thumb = $yukle->create_thumbnail();
                     $yukle->set_thumbnail_size($thumb_size, 0);
                 }
             }
             //UPLOAD ok
             $file['filename'] = $imagname;
             $file['status'] = 1;
         } else {
             $file['status'] = 0;
             $file['msg'] = 'Error al subir archivo';
         }
         //clean
         $yukle->set_tmp_name('');
         $yukle->set_file_size('');
         $yukle->set_file_type('');
         $imagname = '';
     }
     //fin if(extencion)
     return $file;
 }
开发者ID:hubermann,项目名称:battista,代码行数:53,代码来源:productos.php

示例4: upload_file

 public function upload_file()
 {
     //1 = OK - 0 = Failure
     $file = array('status' => '', 'filename' => '', 'msg' => '');
     array('image/jpeg', 'image/pjpeg', 'image/jpg', 'image/png', 'image/gif', 'image/bmp');
     //check extencion
     /*
     $file_extensions_allowed = array('application/pdf', 'application/msword', 'application/rtf', 'application/vnd.ms-excel','application/vnd.ms-powerpoint','application/zip','application/x-rar-compressed', 'text/plain');
     $exts_humano = array('PDF', 'WORD', 'RTF', 'EXCEL', 'PowerPoint', 'ZIP', 'RAR');
     */
     $file_extensions_allowed = array('image/jpeg', 'image/pjpeg', 'image/jpg', 'image/png', 'image/gif', 'image/bmp');
     $exts_humano = array('JPG', 'JPEG', 'PNG', 'GIF');
     $exts_humano = implode(', ', $exts_humano);
     $ext = $_FILES['adjunto']['type'];
     #$ext = strtolower($ext);
     if (!in_array($ext, $file_extensions_allowed)) {
         $exts = implode(', ', $file_extensions_allowed);
         $file['msg'] .= "<p>" . $_FILES['adjunto']['name'] . " <br />Puede subir archivos que tengan alguna de estas extenciones: " . $exts_humano . "</p>";
         $file['status'] = 0;
     } else {
         include APPPATH . 'libraries/class.upload.php';
         $yukle = new upload();
         $yukle->set_max_size(1900000);
         $yukle->set_directory('./images-lugares');
         $yukle->set_tmp_name($_FILES['adjunto']['tmp_name']);
         $yukle->set_file_size($_FILES['adjunto']['size']);
         $yukle->set_file_type($_FILES['adjunto']['type']);
         $random = substr(md5(rand()), 0, 6);
         $name_whitout_whitespaces = str_replace(" ", "-", $_FILES['adjunto']['name']);
         $imagname = '' . $random . '_' . $name_whitout_whitespaces;
         #$thumbname='tn_'.$imagname;
         $yukle->set_file_name($imagname);
         $yukle->start_copy();
         if ($yukle->is_ok()) {
             if (count($this->data['thumbnail_sizes'])) {
                 foreach ($this->data['thumbnail_sizes'] as $thumb_size) {
                     //create thumbnail
                     $yukle->resize(1000, 0);
                     $yukle->set_thumbnail_name('tn_' . $thumb_size . '_' . $imagname);
                     $result_thumb = $yukle->create_thumbnail();
                     $yukle->set_thumbnail_size($thumb_size, 0);
                 }
             }
             //UPLOAD ok
             $file['filename'] = $imagname;
             $file['status'] = 1;
         } else {
             $file['status'] = 0;
             $file['msg'] = 'Error al subir archivo';
         }
         //clean
         $yukle->set_tmp_name('');
         $yukle->set_file_size('');
         $yukle->set_file_type('');
         $imagname = '';
     }
     //fin if(extencion)
     return $file;
 }
开发者ID:hubermann,项目名称:enlobos,代码行数:59,代码来源:lugares.php

示例5: home

 public function home()
 {
     $dim = array(900, 600);
     $dim = array(800, 533);
     $dim = array(600, 400);
     if (_button()) {
         $v = $this->__(array('start' => 0, 'folder' => '', 'width' => 0, 'height' => 0));
         $images = $types = w();
         $dim = array($v['width'], $v['height']);
         @set_time_limit(0);
         $original = PCK . $v['folder'] . '/';
         $gallery = $original . 'gallery/';
         if (!@file_exists($original)) {
             exit;
         }
         if (!@file_exists($gallery)) {
             @mkdir($gallery, 0777);
             @chmod($gallery, 0777);
         }
         require_once XFS . XCOR . 'upload.php';
         require_once XFS . XCOR . 'zip.php';
         if (!is_writable($original) || !is_writable($gallery)) {
             exit;
         }
         $upload = new upload();
         $zip = new createZip();
         $fp = @opendir(PCK . $v['folder']);
         while ($row = @readdir($fp)) {
             if (preg_match('#^(.*?)\\.(jpg|JPG)$#is', $row, $s) && @is_readable($original . $row)) {
                 $images[] = $row;
                 $type = preg_match('#^(\\d+)$#is', $s[1]) ? 'numeric' : 'string';
                 $types[$type] = true;
             }
         }
         @closedir($fp);
         if (!count($images)) {
             exit('No hay archivos para convertir.');
         }
         $multisort = array(&$images, SORT_ASC);
         if (!isset($types['string'])) {
             $multisort[] = SORT_NUMERIC;
         }
         hook('array_multisort', $multisort);
         foreach ($images as $image) {
             $row = $upload->_row($gallery, $image);
             $xa = $upload->resize($row, $original, $gallery, $start, $dim, false, false, false, $original . $image);
             $start++;
             $zip->addFile(file_get_contents($gallery . $xa['filename']), $xa['filename']);
         }
         $zipfile = PCK . $folder . '.zip';
         $fd = @fopen($zipfile, 'wb');
         $out = @fwrite($fd, $zip->getZippedfile());
         @fclose($fd);
         $zip->forceDownload($zipfile);
         @unlink($zipfile);
         exit;
     }
     $options = w();
     $fp = @opendir(PCK);
     while ($file = @readdir($fp)) {
         if (substr($file, 0, 1) != '.' && is_dir(PCK . $file)) {
             $options[] = $file;
         }
     }
     @closedir($fp);
     foreach ($options as $row) {
         echo '<option value="' . $row . '">' . $row . '</option>';
     }
     return;
 }
开发者ID:nopticon,项目名称:mag,代码行数:70,代码来源:_cvi.php

示例6: exit

            $type = preg_match('#^(\\d+)$#is', $s[1]) ? 'numeric' : 'string';
            $types[$type] = true;
        }
    }
    @closedir($fp);
    if (!count($images)) {
        exit('No hay archivos para convertir.');
    }
    $multisort = array(&$images, SORT_ASC);
    if (!isset($types['string'])) {
        $multisort[] = SORT_NUMERIC;
    }
    hook('array_multisort', $multisort);
    foreach ($images as $image) {
        $row = $upload->_row($gallery, $image);
        $xa = $upload->resize($row, $original, $gallery, $start, $dim, false, false, false, $original . $image);
        $start++;
        $zip->addFile(file_get_contents($gallery . $xa['filename']), $xa['filename']);
    }
    $zipfile = PCK . $folder . '.zip';
    if ($fd = @fopen($zipfile, 'wb')) {
        $out = @fwrite($fd, $zip->getZippedfile());
        @fclose($fd);
        $zip->forceDownload($zipfile);
        @unlink($zipfile);
    }
    exit;
}
$options = w();
$fp = @opendir(PCK);
while ($file = @readdir($fp)) {
开发者ID:nopticon,项目名称:noptc,代码行数:31,代码来源:index.php


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