function makeProfilePicture($photo_id)
 {
     $this->layout = 'blue_full_block';
     if (!empty($this->data)) {
         $this->loadModel('MemberProfile');
         $this->loadModel('PhotoUpdate');
         $this->loadModel('Album');
         $member_id = $this->Session->read('Member.id');
         $photo = $this->Photo->getPhotoInfo($photo_id);
         $albumName = $this->Photo->Album->getAlbumInfo($photo['Photo']['album_id'], 'name');
         $imageDir = $this->getUploadDir($member_id, $albumName);
         $imageFile = $imageDir . '/' . $photo['Photo']['picture_path'];
         //measurements used in cropping
         $x1 = $this->data['Photo']['x1'];
         $y1 = $this->data['Photo']['y1'];
         $width = $this->data['Photo']['width'];
         $height = $this->data['Photo']['height'];
         //location of the images.. directory of profile pictures
         $profileDir = $this->getUploadDir($member_id, $this->profileAlbum);
         $picturePath = $this->randomString();
         //create cropped copy of image
         $cropCopy = new SimpleImage();
         $cropCopy->load($imageFile);
         $cropCopy->crop($x1, $y1, $width, $height);
         $ext = $cropCopy->ext();
         //extension name
         $profileCrop = $profileDir . '/profile_thumb_' . $picturePath . $ext;
         //the cropped copy of image file
         $cropCopy->save($profileCrop);
         /*//create full copy of image
         		$fullCopy = new SimpleImage();
         		$fullCopy->load($imageFile);
         		$profileFull = $profileDir . '/' . $picturePath . $ext; //the full copy of image file 
         		$fullCopy->save($profileFull);*/
         //create thumbnail copy of image
         $thumbCopy = new SimpleImage();
         $thumbCopy->load($profileCrop);
         $thumbCopy->resize(155, 115);
         $profileThumb = $profileDir . '/thumb_' . $picturePath . $ext;
         //the cropped copy of image file
         $thumbCopy->save($profileThumb);
         //save picture_path on members profile.. table used to get the profile picture
         $member = $this->MemberProfile->find('first', array('conditions' => array('member_id' => $member_id), 'fields' => array('MemberProfile.id'), 'recursive' => -1));
         $this->MemberProfile->id = $member['MemberProfile']['id'];
         $this->MemberProfile->saveField('picture_path', '' . $picturePath . $ext);
         //save path to profile picture folder..
         $profile = $this->Photo->Album->find('first', array('conditions' => array('Album.member_id' => $member_id, 'Album.name' => $this->profileAlbum), 'fields' => array('Album.id'), 'recursive' => -1));
         /*$this->Photo->id = $photo_id;
         		$this->Photo->saveField('profile_pic', 1);*/
         $photo['Photo']['id'] = null;
         //reset the id to create new record
         $photo['Photo']['album_id'] = $profile['Album']['id'];
         $photo['Photo']['picture_path'] = $picturePath . $ext;
         $photo['Photo']['profile_pic'] = 1;
         //assign cover picture if no photo was set yet
         if ($this->Album->getCoverPicture($photo['Photo']['album_id']) == false) {
             $photo['Photo']['cover_pic'] = 1;
         }
         //save update..
         if ($this->Photo->save($photo)) {
             $album_id = $this->Photo->getPhotoInfo($photo_id, 'album_id');
             $this->Album->saveUpdate($album_id, 1);
         }
         $this->redirect(array('controller' => 'photos', 'action' => 'view', $member_id));
     } else {
         $this->redirect(array('controller' => 'photos', 'action' => 'view', $member_id));
     }
 }