id = $id; if ( $_SERVER['SERVER_NAME'] == 'localhost'){ //test if (!empty($image_folder)){ $this->image_folder = $image_folder; $this->root_image_folder = "C:/Installer/ecigarettecritic.com/images/".$image_folder."/"; }else{ $this->root_image_folder = "C:/Installer/ecigarettecritic.com/images/reviews/"; } $this->server_name = "http://localhost"; }else{ if (!empty($image_folder)){ $this->image_folder = $image_folder; $this->root_image_folder = "/www/virtual/hmpporn/www.vapinginspector.com/images/".$image_folder."/"; }else{ $this->root_image_folder = "/www/virtual/hmpporn/www.vapinginspector.com/images/reviews/"; } $this->server_name = "http://www.vapinginspector.com"; } } function getImages(){ //if ( $_SERVER['SERVER_NAME'] == 'localhost'){ //test // $path = $_SERVER['DOCUMENT_ROOT'] . "/images/reviews/". $this->id ."/*.*" ; //}else{ $path = $this->root_image_folder . $this->id ."/*.*" ; //} return glob( $path ); } function getImageUrl(){ //if ( $_SERVER['SERVER_NAME'] == 'localhost') //test // return "http://localhost"; //else // return $this->server_name; return $this->root_image_folder; } function getImageHttpUrl(){ //if ( $_SERVER['SERVER_NAME'] == 'localhost') //test // return "http://localhost/images/reviews/". $this->id ."/"; //else if (!empty($image_folder)){ return $this->server_name . "/images/".$this->image_folder."/". $this->id ."/"; }else{ return $this->server_name . "/images/reviews/". $this->id ."/"; } } function getImagePath(){ //if ( $_SERVER['SERVER_NAME'] == 'localhost'){ //test // $path = $_SERVER['DOCUMENT_ROOT'] . "/images/reviews/". $this->id ."/" ; //}else{ $path = $this->root_image_folder . $this->id ."/" ; //} return $path; } function createThumbnailFolder(){ $folder = $this->getImagePath() . "tn/"; if(!file_exists( $folder )) if(!mkdir( $folder, 0777, true )){ echo "error creating folder: " . $folder ."
". print_r(error_get_last()); } } function getThumbnail($img_filename){ return $this->getImagePath() . "tn/". basename($img_filename); // $thumnail_filename ; } function getThumbnailUrl($img_filename){ return $this->getImageHttpUrl() . "tn/". basename($img_filename); // $thumnail_filename ; } function uploadImage($userfile, $userfile_size, $userfile_name, $userfile_type){ //$userfile = clean($userfile, 100); // Was a file uploaded? global $db; //$folder = $_SERVER['DOCUMENT_ROOT'] . "/images/reviews/" . $this->id; $folder = $this->getImagePath(); if(!file_exists( $folder )) mkdir( $folder, 0777, true ); //create folder if not already exist //$target_file_name = $folder ."_". date("YmdHis") . "_" . $userfile_name; $this->img_file_name = $this->id ."_". date("YmdHis") . "_" . $userfile_name; $target_file_name = $folder ."/". $this->img_file_name; //$this->id ."_". date("YmdHis") . "_" . $userfile_name; $mimeName = ""; $valid_file = true; if (is_uploaded_file($userfile)){ switch ($userfile_type){ case "image/gif"; $mimeName = "GIF Image"; break; case "image/jpeg"; $mimeName = "JPEG Image"; break; case "image/pjpeg"; $mimeName = "JPEG Image"; break; case "image/png"; $mimeName = "PNG Image"; break; case "image/x-MS-bmp"; $mimeName = "Windows Bitmap"; break; default: $mimeName = $userfile_type;//"Unknown image type"; $valid_file = false; } /* if ($userfile_size/1024 > 10240) //550000) { $this->upload_message = "The file uploaded is too large."; return false; } */ //echo "target_file_name: " . $target_file_name; if($valid_file){ if(move_uploaded_file($userfile, $target_file_name)){ $this->upload_message = "The file ". basename( $userfile ). " has been uploaded"; chmod($target_file_name, 0777); }else{ $this->upload_message = "Sorry, there was a problem uploading your file."; } }else{ $this->upload_message = "Invalid file type."; } return $valid_file; } else { $this->upload_message= " is_uploaded_file() failed "; return false; } } static function getImageType($filename) { $mimeType = ""; //echo strtolower(strrchr($filename, ".")); //exit; switch (strtolower(strrchr($filename, "."))) { case ".gif"; $mimeType = "image/gif"; break; case ".jpg"; $mimeType = "image/jpeg"; break; case ".png"; $mimeType = "image/png"; break; case ".bmp"; $mimeType = "image/x-MS-bmp"; break; default: $mimeType = "Unknown image type"; } return $mimeType; } } ?>
Fatal error: Class 'ImageUpload' not found in /var/www/sites/www.ecigarettecritic.com/html/review.php on line 34