code: public boolean handleImageUpload(CmsObject cms, CmsUser user, String uploadedFile) {
  
          boolean result = false;
          try {
              setUserImage(cms, user, uploadedFile);
              result = true;
          } catch (CmsException e) {
              LOG.error("Error setting user image.", e);
          }
          try {
              cms.lockResource(uploadedFile);
              cms.deleteResource(uploadedFile, CmsResource.DELETE_REMOVE_SIBLINGS);
          } catch (CmsException e) {
              LOG.error("Error deleting user image temp file.", e);
          }
          return result;
      }
docs: Handles a user image upload.
  The uploaded file will be scaled and save as a new file beneath /system/userimages/, the original file will be deleted.<p>
  
  @param cms the cms context
  @param user the user
  @param uploadedFile the uploaded file
  
  @return <code>true</code> in case the image was set successfully