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

Размер файла: 955B
  1. <?
  2. /**********************************
  3. * @package: PerfCMS *
  4. * @year: 2012 *
  5. * @author: Artas *
  6. * @link: http://perfcms.org.ua *
  7. **********************************/
  8. import_lib('upload.class');
  9. if(file_exists(ROOT.'/files/avatars/'.cyrlat($user['nick']).'.png')) {
  10. unlink(ROOT.'/files/avatars/'. cyrlat($user['nick']) .'.png');
  11. }
  12. $handle = new upload($_FILES['avatar']);
  13. if ($handle->uploaded) {
  14. $handle->allowed = array('image/*');
  15. $handle->file_new_name_body = cyrlat($user['nick']);
  16. $handle->image_convert = 'png';
  17. $handle->image_resize = true;
  18. $handle->image_x = 100;
  19. $handle->image_y = 120;
  20. $handle->process(ROOT. '/files/avatars/');
  21. if ($handle->processed) {
  22. // echo 'image resized';
  23. $handle->clean();
  24. go('/user/avatar/');
  25. } else {
  26. // echo 'error : ' . $handle->error;
  27. go('/user/avatar/');
  28. }
  29. }
  30. ?>