Example #1
0
 /**
  * Process an image upload and set the image
  * @param String $postfield the $_POST field the image was uploaded through
  * @return boolean
  */
 public function processImage($postfield)
 {
     require_once 'mediaManager.php';
     $im = new Imagemanager();
     $prefix = time();
     if ($im->loadFromPost($postfield, $this->registry->getSetting('upload_path') . 'status/images/' . $this->username, $prefix)) {
         $im->resizeScaleWidth(150);
         $im->save($this->registry->getSetting('upload_path') . 'status/images/' . $this->username . '/' . $im->getName());
         $this->image = $im->getName();
         return true;
     } else {
         return false;
     }
 }
Example #2
0
 /**
  * Process an image upload and set the image
  * @param String $postfield the $_POST field the image was uploaded through
  * @return boolean
  */
 public function processImage($postfield)
 {
     require_once FRAMEWORK_PATH . 'lib/images/imagemanager.class.php';
     $im = new Imagemanager();
     $prefix = time() . '_';
     if ($im->loadFromPost($postfield, $this->registry->getSetting('upload_path') . 'statusimages/', $prefix)) {
         $im->resizeScaleWidth(150);
         $im->save($this->registry->getSetting('upload_path') . 'statusimages/' . $im->getName());
         $this->image = $im->getName();
         return true;
     } else {
         return false;
     }
 }
 /**
  * Edit your profile
  * @return void
  */
 private function editProfile()
 {
     if ($this->registry->getObject('authenticate')->isLoggedIn() == true) {
         $user = $this->registry->getObject('authenticate')->getUser()->getUserID();
         if (isset($_POST) && count($_POST) > 0) {
             // edit form submitted
             $profile = new Profile($this->registry, $user);
             $profile->setBio($this->registry->getObject('db')->sanitizeData($_POST['bio']));
             $profile->setName($this->registry->getObject('db')->sanitizeData($_POST['name']));
             $profile->setDinoName($this->registry->getObject('db')->sanitizeData($_POST['dino_name']));
             $profile->setDinoBreed($this->registry->getObject('db')->sanitizeData($_POST['dino_breed']));
             $profile->setDinoGender($this->registry->getObject('db')->sanitizeData($_POST['dino_gender']), false);
             $profile->setDinoDOB($this->registry->getObject('db')->sanitizeData($_POST['dino_dob']), false);
             if (isset($_POST['profile_picture'])) {
                 require_once FRAMEWORK_PATH . 'lib/images/imagemanager.class.php';
                 $im = new Imagemanager();
                 $im->loadFromPost('profile_picture', $this->registry->getSetting('uploads_path') . 'profile/', time());
                 if ($im == true) {
                     $im->resizeScaleHeight(150);
                     $im->save($this->registry->getSetting('uploads_path') . 'profile/' . $im->getName());
                     $profile->setPhoto($im->getName());
                 }
             }
             $profile->save();
             $this->registry->redirectUser(array('profile', 'view', 'edit'), 'Profile saved', 'The changes to your profile have been saved', false);
         } else {
             // show the edit form
             $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'profile/information/edit.tpl.php', 'footer.tpl.php');
             // get the profile information to pre-populate the form fields
             require_once FRAMEWORK_PATH . 'models/profile.php';
             $profile = new Profile($this->registry, $user);
             $profile->toTags('p_');
         }
     } else {
         $this->registry->errorPage('Please login', 'You need to be logged in to edit your profile');
     }
 }