Ejemplo n.º 1
0
 function uploadFile($filepath)
 {
     // getting paths
     $uploadedfile = $filepath;
     $uploaddir = $this->uploadDir;
     // creating Directory of logged in  userid
     $dir = $_SESSION['foongigs_userid'];
     if ($dir) {
         if (!file_exists($uploaddir . $dir . "/")) {
             mkdir($uploaddir . $dir . "/", 0777);
         }
     }
     // creating files
     $image = new image($imagepath);
     $this->randfilename = $image->getFileName();
     $this->fileext = $image->getFileExtension();
     $this->width = $image->getImageHeight();
     $this->height = $image->getImageWidth();
     for ($i = 0; $i < count($size); $i++) {
         $dimension = explode("x", $size[$i]);
         $destination = $uploaddir . $dir . "/" . $this->randfilename . "_" . $size[$i] . "." . $this->fileext;
         $image->createAndResize($destination, $dimension[0], $dimension[1], $this->imageQuality);
     }
     // Upload Original File....
     $destination = $uploaddir . $dir . "/" . $this->randfilename . "_original" . "." . $this->fileext;
     $image->moveTo($destination);
 }
Ejemplo n.º 2
0
 /**
  * 获得图像宽度
  *
  * @return int 图像宽度
  */
 function getWidth()
 {
     return $this->image->getImageWidth();
 }