Esempio n. 1
0
 /**
  * Kép feltöltés
  */
 private function _uploadPicture($files_array)
 {
     $upload_path = Config::get('blogphoto.upload_path');
     $width = Config::get('blogphoto.width', 600);
     $height = Config::get('blogphoto.height', 400);
     $image = new Uploader($files_array);
     // új filenév
     $newfilename = 'blog_' . md5(uniqid());
     // nagy kép
     $image->allowed(array('image/*'));
     $image->cropToSize($width, $height);
     $image->save($upload_path, $newfilename);
     $filename = $image->getDest('filename');
     if ($image->checkError()) {
         Message::set('error', $image->getError());
         return false;
     } else {
         // nézőkép
         $thumb_width = Config::get('blogphoto.thumb_width', 150);
         $thumb_height = $image->calcHeight($thumb_width);
         $image->cropToSize($thumb_width, $thumb_height);
         $image->save($upload_path, $newfilename . '_thumb');
     }
     $image->cleanTemp();
     // kép neve
     return $filename;
 }
Esempio n. 2
0
 /**
  * Kép feltöltés
  * @param array $files_array - $_FILES['valami']
  * @return string
  */
 private function _uploadImage($files_array)
 {
     $upload_path = Config::get('photogallery.upload_path');
     $photo_width = Config::get('photogallery.width', 800);
     $photo_height = Config::get('photogallery.height', 600);
     $image = new Uploader($files_array);
     $newfilename = md5(uniqid());
     $image->allowed(array('image/*'));
     $image->cropToSize($photo_width, $photo_height);
     $image->save($upload_path, $newfilename);
     $dest_filename = $image->getDest('filename');
     if ($image->checkError()) {
         Message::set('error', $image->getError());
         return false;
     } else {
         $thumb_width = Config::get('photogallery.thumb_width', 320);
         $thumb_height = Config::get('photogallery.thumb_height', 240);
         $image->cropToSize($thumb_width, $thumb_height);
         $image->save($upload_path, $newfilename . '_thumb');
     }
     // visszatér a kép nevével
     return $dest_filename;
 }