예제 #1
0
 function load_foto_adv($file, $img_old, $img_small_old, $x, $y)
 {
     global $user;
     require_once 'classes/thumblib.inc.php';
     require_once 'classes/resize.class.php';
     $size = new Resize();
     $folder = 'adv/';
     @mkdir($folder, 0777);
     $size->dir = $folder;
     // Директория изображений
     $size->original = true;
     if ($file['name']) {
         $size->setResize($file);
         if (!$size->error) {
             @unlink($img_old);
             @unlink($img_small_old);
             $img_small = $size->small;
             $img = $size->image;
             $thumb = PhpThumbFactory::create($img);
             $thumb->resize($x, 0);
             $thumb->save($img_small);
             $img = $img;
             $img_small = $img_small;
         } else {
             $error = $size->error;
         }
     } else {
         $img_small = $img_small_old;
         $img = $img_old;
     }
     $result = array('error' => $error, 'img' => $img, 'img_small' => $img_small);
     return $result;
 }