ComusThumbz 文档
管理员登录

Category Management

Overview

The Category Management page is the central hub for creating, editing, and managing content categories in ComusThumbz. Categories organize galleries, videos, and webcam content into browsable sections for the frontend. This page provides comprehensive category administration including image uploads with cropping, statistics tracking, and detailed configuration options for traffic management, content types, and submission settings.

Location: Navigate to Admin Panel → Categories or directly from the Dashboard

[Screenshot: categories-main-grid-view]


Getting to This Page

  1. Log into the Admin Panel
  2. From the Dashboard (main.php), click on Categories in the navigation
  3. Alternatively, click the Categories link in the sidebar menu
  4. Direct URL: ct/admin/categories.php

 

Note:
This page has three distinct modes:
  • Grid/Table View - Default view showing all categories
  • Edit Mode - Full category configuration (accessed via Edit button)
  • Crop Mode - Image cropping interface (accessed after uploading an image)

 


System Requirements

 

Configuration Required:
This page requires the following system dependencies to function properly.

 

PHP Requirements

Requirement Minimum Recommended Notes
PHP Version 8.0 8.2+ Uses null coalescing operators
memorylimit 128M 256M For image processing operations
maxexecutiontime 60 120 For statistics calculation
uploadmaxfilesize 10M 20M For category image uploads
postmaxsize 12M 25M Should exceed uploadmaxfilesize

Required PHP Extensions

Extension Required Purpose
mysqli Yes Database connectivity
gd Yes Image cropping and resizing
session Yes Crop workflow state management
json Yes JavaScript data serialization

Required PHP Functions

Function Required For Notes
imagecreatefromjpeg() JPEG image loading GD library
imagecreatefrompng() PNG image loading GD library
imagecreatefromgif() GIF image loading GD library
imagecreatetruecolor() Canvas creation GD library
imagecopy() Crop region extraction GD library
imagecopyresampled() High-quality resize GD library
imagejpeg() Save cropped image GD library
imagedestroy() Memory cleanup GD library
getimagesize() Image dimension detection GD library
moveuploadedfile() File upload handling Core
fileputcontents() Statistics cache writing Core
filegetcontents() Statistics cache reading Core
serialize() / unserialize() Cache data encoding Core
base64encode() / base64decode() Cache data transport Core

Folder Permissions

Folder Permission Purpose
ct/images/cats/ 755 (write) Category image storage
ct/dat/ 755 (write) Statistics cache file (cstats.dat)

Features & UI Elements

Page Header

[Screenshot: categories-page-header]

Element Description
Title "Category Management" with folder icon
Breadcrumb Dashboard → Categories
Back to Dashboard Returns to main.php
Galleries Button Quick link to admin.php (gallery management)
Videos Button Quick link to video.admin.php
Models Button Quick link to models.php

Statistics Dashboard

[Screenshot: categories-stats-dashboard]

Eight statistic cards display overall category metrics:

Stat Icon Description
Total Categories Folder Number of categories in database
Total Galleries Images Sum of galleries across all categories
Total Videos Video Sum of videos across all categories
TGP Clicks Mouse Pointer Gallery clicks (from tblTgp.clicks field)
TGP True Clicks Bullseye Real gallery clicks from tblClickTracking
Video Clicks Play Circle Video views (from tblVideos.viewsoverride)
Video True Clicks Crosshairs Real video clicks from tblClickTracking
Camgirls True Clicks Camera Webcam performer clicks from tblClickTracking
Tip: Understanding Click Types:
  • Regular Clicks (TGP Clicks, Video Clicks): These can be manipulated/overridden values for display purposes
  • True Clicks: Actual click tracking data from tblClickTracking - more accurate for analytics

Action Bar

[Screenshot: categories-action-bar]

Element Description
Add Category Input Text field to enter new category name
Add Category Button Creates new category with default settings
Update Stats Button Manually recalculates all category statistics

View Controls

Element Description
Cards Button Switch to card/grid view (default)
Table Button Switch to compact table view

Column Customizer (Table View Only)

[Screenshot: categories-column-customizer]

An expandable accordion that allows customizing which columns appear in table view:

Feature Description
Drag to Reorder Drag column items to change display order
Check/Uncheck Show or hide individual columns
Yellow Items Mandatory columns that cannot be hidden
Apply Button Save and apply column configuration
Reset to Default Restore default column layout

Available Columns:

  • Image, Category Name (mandatory), Galleries, Videos, Approved
  • TGP Clicks, TGP True Clicks, Video Clicks, Video True Clicks, Camgirls True Clicks
  • Thumb Size, Max Galleries, Content Types, Status, Actions (mandatory)

Card View

[Screenshot: categories-card-view]

Each category card displays:

Card Image Section

  • Category Image - If uploaded, displays the cropped category image
  • Placeholder Icon - Folder icon if no image uploaded

Card Body

Element Description
Category Name Bold name with underline accent
Galleries Count Number of galleries in this category
Videos Count Number of videos in this category
Approved Count Number of approved galleries
TGP Clicks Gallery click count
TGP True Clicks Real gallery clicks
Video Clicks Video view count
Video True Clicks Real video clicks
Camgirls True Clicks Webcam performer clicks

Card Actions

Button Description
Edit Category Opens full category editor
Add/Change Image Opens upload modal
Delete Image Removes category image (if present)
Delete Category Deletes entire category (with confirmation)

Table View

[Screenshot: categories-table-view]

Compact list format with customizable columns:

Feature Description
Thumbnail Small category image preview (60×45px)
Category Name Clickable link to edit mode
Statistics Columns Configurable via column customizer
Action Buttons Edit, Image, Delete options

Edit Mode

[Screenshot: categories-edit-mode]

The full category editor is accessed by clicking Edit Category on any category card or clicking the category name in table view.

Basic Settings Section

Field Type Description
Category Name Text The display name for this category
Thumbnail Width Number Width for generated thumbnails (pixels)
Thumbnail Height Number Height for generated thumbnails (pixels)
Max Galleries Number Maximum galleries allowed in this category

Content Types Section

Checkbox Description
Gallery Support Enable/disable gallery content for this category
Video Support Enable/disable video content for this category
Webcams Support Enable/disable webcam performer content

Traffic Settings Section

Field Description
Click Period (hours) Time period for click tracking window
Hold Period (hours) Time to hold content before rotation
Shave % (Future Use) Traffic shaving percentage
Shave1 % (Future Use) Secondary shaving percentage
Immune Checkbox - Exempt from certain traffic rules
Spin Checkbox - Enable rotation/spinning
Hide Checkbox - Hide category from public view

Submission Settings Section

Field Description
Max Submits Maximum submissions allowed per webmaster
Entry Page (Future Use) Custom entry page URL
Locked Checkbox - Prevent new submissions
Hosted Checkbox - Mark as hosted content category
No Trade Checkbox - Exclude from trade programs

Advanced Settings Section

Field Description
Subcategory Parent category relationship
Alternate Alternative category name/alias
Keywords SEO keywords for this category
Overlay Watermark/overlay image path
Default Overlay On Apply overlay by default
Censor Thumbnail Enable thumbnail censoring
Keep Best Retain highest-quality content

Skim Settings Section (Future Use)

Field Description
Skim URL URL for traffic skimming redirect
Skim Percent Percentage of traffic to skim
Text Skim URL Text link skim destination
Text Skim Percent Text link skim percentage
Warning: The Skim Settings and some other fields marked "(For Future Use)" are read-only placeholders. They are retained for backward compatibility with legacy systems but are not actively used in the current version.

Crop Mode

[Screenshot: categories-crop-mode]

After uploading an image, the crop interface appears:

Crop Canvas

  • Source Image - Displayed with max 800px width
  • Dark Overlay - Covers non-selected areas
  • Selection Box - Green-bordered selection area
  • Aspect Ratio Lock - Selection maintains $CATWSIZE:$CATHSIZE ratio

Preview Panel

  • Live Preview - Real-time preview at target dimensions
  • Dimensions Display - Shows target size (e.g., "260×400px")

Crop Controls

Button Description
Save Cropped Image Process and save the cropped image
Cancel Return to category list without saving

How to Crop

  1. Click and drag on the source image to define selection
  2. The aspect ratio is automatically maintained
  3. Watch the preview update in real-time
  4. Click Save Cropped Image when satisfied

Step-by-Step Usage

Adding a New Category

  1. Navigate to Admin Panel → Categories
  2. In the Action Bar, type the new category name
  3. Click Add Category
  4. Success message confirms creation
  5. New category appears in the grid with default settings

Editing a Category

  1. Find the category in grid or table view
  2. Click Edit Category button
  3. Modify desired settings in each section
  4. Click Save Changes at the bottom
  5. Redirected back to category list with success message

Uploading a Category Image

  1. Click Add Image (or Change Image) on a category card
  2. Modal opens with file selector
  3. Choose JPG, PNG, or GIF image
  4. Click Upload and Crop
  5. Crop interface loads with your image
  6. Draw selection box to define crop area
  7. Preview updates in real-time
  8. Click Save Cropped Image
  9. Redirected to category list with success message

Deleting a Category Image

  1. Find category with existing image
  2. Click Delete Image button
  3. Confirm the deletion
  4. Image is removed, placeholder icon appears

Deleting a Category

  1. Find the category to delete
  2. Click Delete Category (orange button)
  3. Read the confirmation warning carefully
  4. Confirm deletion
  5. Category and its image are permanently removed

 

Warning:
Deleting a category does NOT delete associated galleries or videos. Content remains in the database but loses its category association. You may want to reassign content before deleting categories.

 

Refreshing Statistics

  1. Click Update Stats button in action bar
  2. Wait for calculation to complete (may take several seconds with large datasets)
  3. Success message confirms update
  4. All statistics cards refresh with new values

 

Note:
Statistics are cached for 1 hour (3600 seconds) in ct/dat/cstats.dat. The cache is automatically refreshed when it expires or when you click Update Stats.

 

Switching Between Views

  1. Use the Cards / Table toggle buttons
  2. View preference is saved to localStorage
  3. Table view shows column customizer accordion
  4. Drag columns to reorder, check/uncheck to show/hide
  5. Click Apply to save column configuration

Statistics Explained

Metric Source Description
Galleries COUNT() FROM tblTgp WHERE category=? Total galleries
Approved COUNT() FROM tblTgp WHERE category=? AND accept='yes' Approved galleries
TGP Clicks SUM(clicks) FROM tblTgp WHERE category=? Stored click count
TGP True Clicks COUNT(DISTINCT) FROM tblClickTracking Real click events

Video Statistics

Metric Source Description
Videos Join tblVideos ↔ tblVideoCategories ↔ tblCategories Video count
Video Clicks SUM(viewsoverride) FROM tblVideos Stored view count
Video True Clicks COUNT(DISTINCT) FROM tblClickTracking Real click events

Webcam Statistics

Metric Source Description
Camgirls True Clicks COUNT(DISTINCT) FROM tblClickTracking WHERE contenttype='camperformer' Performer clicks

Image Processing

File Handling Workflow

  1. Upload → File saved to ct/images/cats/ as tempcat{id}{timestamp}.{ext}
  2. Crop → User defines selection area on canvas
  3. Process → GD library extracts and resizes selection
  4. Save → Final image saved as cat{id}.jpg with 85% JPEG quality
  5. Cleanup → Temporary file deleted
  6. Databasecategoryimage column updated

Supported Formats

Format Extension Notes
JPEG .jpg, .jpeg Most common, recommended
PNG .png Supports transparency (converted to JPEG)
GIF .gif Static only (converted to JPEG)

Output Specifications

Property Value
Format JPEG
Quality 85%
Dimensions $CATWSIZE × $CATHSIZE (default: 260×400)
Filename cat{categoryid}.jpg
Location ct/images/cats/

Troubleshooting

Common Errors

 

Error:
"Connection failed"


Cause: Database connection error
Solution:

  1. Verify database credentials in ct/dat/config.inc.php
  2. Check MySQL service is running
  3. Verify database user has SELECT, INSERT, UPDATE, DELETE permissions

 

 

Error:
"Error updating category"


Cause: SQL UPDATE query failed
Solution:

  1. Check database connection
  2. Verify tblCategories has all required columns
  3. Check for database locks or quota issues

 

 

Error:
Image not displaying after upload


Cause: File permissions or path issues
Solution:

  1. Verify ct/images/cats/ folder exists and is writable (755)
  2. Check the categoryimage value in database matches actual filename
  3. Verify image file exists at expected path

 

 

Error:
"Failed to move uploaded file"


Cause: PHP upload or permission issue
Solution:

  1. Check uploadmaxfilesize and postmaxsize in php.ini
  2. Verify ct/images/cats/ is writable by web server
  3. Check available disk space

 

 

Error:
Crop not saving correctly


Cause: GD library issue or coordinate calculation error
Solution:
Verify GD extension is installed and enabled

  1. Check PHP memorylimit is sufficient (128M+)
  2. Ensure source image loaded correctly before cropping

 

 

Warning:
Statistics not updating


Cause: Cache not invalidating or calculation error
Solution:

  1. Click Update Stats to force recalculation
  2. Delete ct/dat/cstats.dat manually to clear cache
  3. Check for database query errors in PHP logs

 

 

Warning:
Category not appearing on frontend


Cause: Category may be hidden or have no content
Solution:

  1. Check the Hide checkbox is unchecked in Edit mode
  2. Verify category has content (galleries/videos) assigned
  3. Check content type toggles (Gallery Support, Video Support) are enabled

 

Performance Issues

 

Warning:
Page loads slowly


Solutions:

  1. Statistics calculation can be slow with many categories/content
  2. Use cached statistics (automatic after first load)
  3. Reduce number of categories if possible
  4. Ensure database indexes exist on tblTgp.category and tblVideoCategories.categoryid

 


JavaScript Features

LocalStorage Keys

Key Purpose
categoriesViewPreference Stores view preference (card/table)
categoriesColumnSettings Stores column configuration for table view

Client-Side Functions

Function Purpose
setView(viewType) Toggle between card and table views
toggleAccordion(bodyId, headerElement) Expand/collapse accordion panels
loadColumnSettings() Load saved column configuration
renderColumnList() Render draggable column items
applyColumnSettings() Save and apply column preferences
resetColumnSettings() Reset to default column layout
renderDynamicTable() Generate table HTML based on column settings
getCellValue(cat, columnId) Get formatted cell value for table
openUploadModal(categoryId, categoryName) Open image upload modal
closeUploadModal() Close upload modal

Drag and Drop

The column customizer supports full drag-and-drop reordering:

  • Drag handle icon on each column item
  • Visual feedback during drag operation
  • Automatic index recalculation on drop

 


Translatable Strings

The following strings should be added to backendtranslations.md:

categoriestitle = "Category Management"
categoriesbreadcrumb = "Categories"
categoriesbackdashboard = "Back to Dashboard"
categoriesgalleries = "Galleries"
categoriesvideos = "Videos"
categoriesmodels = "Models"
categoriesoverallstats = "Overall Statistics"
categoriestotalcategories = "Total Categories"
categoriestotalgalleries = "Total Galleries"
categoriestotalvideos = "Total Videos"
categoriestgpclicks = "TGP Clicks"
categoriestgptrueclicks = "TGP True Clicks"
categoriesvideoclicks = "Video Clicks"
categoriesvideotrueclicks = "Video True Clicks"
categoriescamgirlstrueclicks = "Camgirls True Clicks"
categoriesaddcategory = "Add Category"
categoriesaddcategoryplaceholder = "Enter new category name..."
categoriesupdatestats = "Update Stats"
categoriesviewoptions = "View Options"
categoriesviewcards = "Cards"
categoriesviewtable = "Table"
categoriescustomizecolumns = "Customize List Columns"
categoriescolumndraginfo = "Drag items to reorder. Check/uncheck to show/hide columns. Yellow items are mandatory."
categoriesapply = "Apply"
categoriesresetdefault = "Reset to Default"
categorieseditcategory = "Edit Category"
categoriesaddimage = "Add Image"
categorieschangeimage = "Change Image"
categoriesdeleteimage = "Delete Image"
categoriesdeletecategory = "Delete Category"
categoriesuploadcategoryimage = "Upload Category Image"
categoriesuploadinstructions = "Select an image to upload. You'll be able to crop it to {width}x{height}px after upload."
categoriesallowedformats = "Allowed formats:"
categoriesuploadandcrop = "Upload and Crop"
categoriescancel = "Cancel"
categoriescropimage = "Crop Image for Category"
categoriescropinstructions = "Draw a selection box on the image below. The selected area will be resized to {width} x {height} pixels."
categoriespreview = "Preview"
categoriessavecropped = "Save Cropped Image"
categoriesedittitle = "Edit Category"
categoriesbasicsettings = "Basic Settings"
categoriescategoryname = "Category Name"
categoriesthumbnailwidth = "Thumbnail Width"
categoriesthumbnailheight = "Thumbnail Height"
categoriesmaxgalleries = "Max Galleries"
categoriescontenttypes = "Content Types"
categoriesgallerysupport = "Gallery Support"
categoriesvideosupport = "Video Support"
categorieswebcamssupport = "Webcams Support"
categoriestrafficsettings = "Traffic Settings"
categoriesclickperiod = "Click Period (hours)"
categoriesholdperiod = "Hold Period (hours)"
categoriesshave = "Shave %"
categoriesshave1 = "Shave1 %"
categoriesimmune = "Immune"
categoriesspin = "Spin"
categorieshide = "Hide"
categoriessubmissionsettings = "Submission Settings"
categoriesmaxsubmits = "Max Submits"
categoriesentrypage = "Entry Page"
categorieslocked = "Locked"
categorieshosted = "Hosted"
categoriesnotrade = "No Trade"
categoriesadvancedsettings = "Advanced Settings"
categoriessubcategory = "Subcategory"
categoriesalternate = "Alternate"
categorieskeywords = "Keywords"
categoriesoverlay = "Overlay"
categoriesdefaultoverlayon = "Default Overlay On"
categoriescensorthumbnail = "Censor Thumbnail"
categorieskeepbest = "Keep Best"
categoriesskimsettings = "Skim Settings"
categoriesskimurl = "Skim URL"
categoriesskimpercent = "Skim Percent"
categoriestextskimurl = "Text Skim URL"
categoriestextskimpercent = "Text Skim Percent"
categoriessavechanges = "Save Changes"
categoriesfutureuse = "(For Future Use)"
categoriessuccessadded = "Category '{name}' added successfully!"
categoriessuccessupdated = "Category updated successfully!"
categoriessuccessimagesaved = "Category image saved successfully!"
categoriessuccessimagedeleted = "Category image deleted successfully!"
categoriessuccessdeleted = "Category '{name}' deleted successfully!"
categoriessuccessstatsupdated = "Statistics updated successfully!"
categoriesconfirmdeleteimage = "Delete this category image?"
categoriesconfirmdelete = "Are you sure you want to delete this entire category? This will remove the category and its image. This action cannot be undone."
categorieserrorupdating = "Error updating category"
categoriesapproved = "Approved"
categoriesthumbsize = "Thumb Size"
categoriescontenttypescol = "Content Types"
categoriesstatus = "Status"
categoriesactions = "Actions"

Version History

Version Date Changes
1.0 2024-10 Initial release with basic category management
1.1 2024-11 Added image upload with cropping
1.2 2024-12 Added Card/Table view toggle, column customization
1.3 2025-01 Added statistics dashboard, true click tracking