/**
  * Create thumbnail
  *
  * @param mixed $userID
  * @param mixed $file
  */
 public function createThumbnail($userID, $file)
 {
     list($currentWidth, $currentHeight, $destType) = getimagesize(DIR_FS_PHOTO . "users/" . $userID . "/original/" . $file);
     $destType = image_type_to_mime_type($destType);
     if ($currentWidth == $currentHeight) {
         $sourceX = 0;
         $sourceY = 0;
     } else {
         if ($currentWidth > $currentHeight) {
             $sourceX = intval(($currentWidth - $currentHeight) / 2);
             $sourceY = 0;
             $currentWidth = $currentHeight;
         } else {
             $sourceX = 0;
             $sourceY = intval(($currentHeight - $currentWidth) / 2);
             $currentHeight = $currentWidth;
         }
     }
     $destPath = DIR_FS_PHOTO . "users/" . $userID . "/thumbnail/" . $file;
     buckys_resize_image(DIR_FS_PHOTO . "users/" . $userID . "/original/" . $file, $destPath, $destType, IMAGE_THUMBNAIL_WIDTH, IMAGE_THUMBNAIL_HEIGHT, $sourceX, $sourceY, $currentWidth, $currentHeight);
 }
 /**
  * @param     $id
  * @param     $file
  * @param int $x
  * @param int $y
  * @param     $size
  * @return bool|void
  */
 public static function saveForumImage($id, $file, $x = 0, $y = 0, $size)
 {
     global $db;
     $sourceFile = DIR_FS_PHOTO_TMP . $file;
     $destFile = DIR_FS_ROOT . "images/forum/logos/" . $file;
     $destFile1 = DIR_FS_ROOT . "images/forum/icons/" . $file;
     list($width, $height, $type, $attr) = getimagesize(DIR_FS_PHOTO_TMP . $file);
     if ($width > MAX_IMAGE_WIDTH || $height > MAX_IMAGE_HEIGHT) {
         buckys_add_message(MSG_PHOTO_MAX_SIZE_ERROR, MSG_TYPE_ERROR);
         return false;
     }
     $destType = image_type_to_mime_type($type);
     //Create Logo File
     buckys_resize_image($sourceFile, $destFile, $destType, 350, 350, $x, $y, $size, $size);
     buckys_resize_image($sourceFile, $destFile1, $destType, 30, 30, $x, $y, $size, $size);
     //Update Category
     $query = $db->prepare("UPDATE " . TABLE_FORUM_CATEGORIES . " SET `image`=%s WHERE categoryID=%d", $file, $id);
     $db->query($query);
     return;
 }