Просмотр файла modules/user/load_avatar.php

Размер файла: 945B
<?
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.pp.ua	  *
**********************************/
require_once(SYS .'/classes/upload.php');
if(file_exists(ROOT.'/files/avatars/'.$user['nick'].'.png')) { 
	unlink(ROOT.'/files/avatars/'. $user['nick'] .'.png');
}
$handle = new upload($_FILES['avatar']);
  if ($handle->uploaded) {
	  $handle->allowed = array('image/*');
      $handle->file_new_name_body 	= $user['nick'];
	  $handle->image_convert 		= 'png';
      $handle->image_resize			= true;
      $handle->image_x				= 100;
      $handle->image_y				= 120;
      $handle->process(ROOT. '/files/avatars/');
      if ($handle->processed) {
          // echo 'image resized';
          $handle->clean();
		  go('/user/avatar/');
      } else {
          // echo 'error : ' . $handle->error;
		  go('/user/avatar/');
      }
  }
?>