Advertisement
Guest User

Untitled

a guest
May 6th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.03 KB | None | 0 0
  1.     public function upload() {
  2.         require_once '../class/Upload.class.php';
  3.         $this->slide_foto = "";
  4.         $dir_dest = '../fotos/slide/';
  5.         $file = $_FILES['slide_foto'];
  6.  
  7.         $handle = new Upload($file);
  8.         if ($handle->uploaded) {
  9.             $handle->file_overwrite = true;
  10.             //$handle->image_convert = 'png';
  11.             //Configuracoes de redimensionamento paisagem
  12.             $plMax = 1300; //largura maxima permitida
  13.             $paMax = 450; // altura maxima permitida
  14.             if ($handle->image_src_x > $plMax || $handle->image_src_y > $paMax) {
  15.                 //$handle->image_ratio_x = true;
  16.                 $handle->image_resize = true;
  17.                 $handle->image_x = 1000;
  18.                 $handle->image_y = 380;
  19.             }
  20.  
  21.             $handle->file_new_name_body = md5(uniqid($file['name']));
  22.             $handle->Process($dir_dest);
  23.             if ($handle->processed) {
  24.                 $this->slide_foto = $handle->file_dst_name;
  25.             }
  26.         }
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement