Exemple #1
0
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);
}
Exemple #2
0
$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;
Exemple #3
0
 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;
 }
Exemple #4
0
 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;
 }
Exemple #5
0
 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;
 }
Exemple #6
0
            $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)) {