public function createMyPhoto($imgFilename)
 {
     $result = array("error" => true);
     $imgFilename_ext = pathinfo($imgFilename, PATHINFO_EXTENSION);
     $imgNewName = helper::generateHash(7);
     $imgOrigin = "origin_" . $imgNewName . "." . $imgFilename_ext;
     $imgNormal = "normal_" . $imgNewName . "." . $imgFilename_ext;
     $imgPreview = "preview_" . $imgNewName . "." . $imgFilename_ext;
     if ($this->checkImg($imgFilename)) {
         list($w, $h, $type) = getimagesize($imgFilename);
         if (rename($imgFilename, "../../" . TEMP_PATH . $imgOrigin)) {
             $imgFilename = "../../" . TEMP_PATH . $imgOrigin;
         }
         if ($type == IMAGETYPE_JPEG) {
             $this->img_resize($imgFilename, "../../" . TEMP_PATH . $imgNormal, 800, 0);
             $photo = new photo($this->db, $imgFilename, 512);
             imagejpeg($photo->getImgData(), "../../" . TEMP_PATH . $imgPreview, 100);
             unset($photo);
             $result['error'] = false;
         } elseif ($type == IMAGETYPE_PNG) {
             //PNG
             $this->img_resize($imgFilename, "../../" . TEMP_PATH . $imgNormal, 800, 0);
             $photo = new photo($this->db, $imgFilename, 512);
             imagepng($photo->getImgData(), "../../" . TEMP_PATH . $imgPreview);
             unset($photo);
             $result['error'] = false;
         } else {
             $result['error'] = true;
         }
     }
     if ($result['error'] === false) {
         $cdn = new cdn($this->db);
         $response = array();
         $response = $cdn->uploadMyPhoto("../../" . TEMP_PATH . $imgOrigin);
         if ($response['error'] === false) {
             $result['originPhotoUrl'] = $response['fileUrl'];
         }
         $response = $cdn->uploadMyPhoto("../../" . TEMP_PATH . $imgNormal);
         if ($response['error'] === false) {
             $result['normalPhotoUrl'] = $response['fileUrl'];
         }
         $response = $cdn->uploadMyPhoto("../../" . TEMP_PATH . $imgPreview);
         if ($response['error'] === false) {
             $result['previewPhotoUrl'] = $response['fileUrl'];
         }
         @unlink("../../" . TEMP_PATH . $imgOrigin);
         @unlink("../../" . TEMP_PATH . $imgNormal);
         @unlink("../../" . TEMP_PATH . $imgPreview);
     }
     return $result;
 }