Gallery Bulk Import
Gallery Bulk Import - User Guide
Page Location: ct/admin/comus.add.php
Menu Path: Admin Panel → Galleries → Bulk Import
Access Level: Administrator (requires login)
Last Updated: 2026-01-01
Overview
The Gallery Bulk Import page allows administrators to import multiple gallery entries at once from CSV-formatted data. This powerful tool supports field mapping through customizable "playlists," model association, thumbnail downloading, duplicate detection, and asynchronous batch processing with real-time progress tracking.
[Screenshot: comus-add-main-form-overview]
Getting to This Page
- Log in to the admin panel at
ct/admin/ctlogin.php - In the left sidebar, click Galleries
- Click Bulk Import or navigate directly to
ct/admin/comus.add.php
This page is designed for importing gallery data from external sources, TGP networks, or CSV exports. All data is first previewed before final import.
System Requirements
This page requires the following system dependencies to function properly.
PHP Requirements
Required PHP Extensions
Required PHP Functions
These functions must NOT be in
disablefunctions in php.ini:Folder Permissions
Server Requirements
Folders Required
External Dependencies
Page Layout
Header Section
The page header displays:
- Title: "Gallery Bulk Import" with a photo icon
- Breadcrumb: Dashboard > Galleries > Bulk Import
- Description: "Import multiple galleries from CSV data with field mapping"
[Screenshot: comus-add-header]
Playlist Section
The playlist section allows you to save and load field mapping configurations:
[Screenshot: comus-add-playlist-section]
Save commonly used import configurations as playlists to speed up future imports from the same data source.
Field Mapping Section
The dynamic field mapping section lets you configure how CSV columns map to database fields:
[Screenshot: comus-add-field-mapping]
Available Field Mappings
Import Data Section
Import Options
[Screenshot: comus-add-import-options]
Features & Functions
Field Mapping Playlists
Purpose: Save and reuse field mapping configurations for repeated imports from the same source.
How to use:
- Configure your field mappings using the column dropdowns
- Enter a unique name in the "Playlist Name" field
- Click Save to store the configuration
- Future imports can load this configuration instantly via the dropdown
Playlist data stored:
- Field mappings (which column = which field)
- Delimiter setting
- All import options (force category, force model, etc.)
Create separate playlists for different data sources: "TGP Network A", "Manual CSV Export", "CMS Export", etc.
Duplicate Detection
Purpose: Prevent duplicate gallery entries from being imported.
Modes:
Detection method: Compares URL and MD5 hash values against existing tblTgp entries.
Model Association
Purpose: Link galleries to performer models during import.
How it works:
- Map a CSV column to field #29 (Model)
- Enter model names, comma-separated
- During import, each name is:
- Looked up in
tblModels - Created if not found (with Active status)
- Linked via
tblGalleryModelsjoin table
Force Model option: Overrides the Model column with a single model for all entries.
URL Validation (Non-Fast Scan)
When Fast scan is NOT enabled, each gallery URL is validated:
- URL format is checked and fixed
- HTTP request is sent with cURL
- Response code is verified (must be < 400)
- Page content is scanned for video file extensions
- Invalid URLs are rejected with error logging
URL validation significantly increases import time. Use Fast scan for trusted data sources.
Thumbnail Download
For each imported gallery with a thumbnail URL:
Thumbnail is downloaded via cURL
- Saved to
ct/thumbs/tn{galleryid}.jpg - Image dimensions are detected with
getimagesize() - Database record is updated with size/dimensions
- Optional FTP distribution if configured
Asynchronous Processing
The import runs asynchronously with real-time progress tracking:
- Preview Step: Data is validated and temp files created
- Run Step: AJAX call triggers background processing
- Status Polling: Frontend polls for progress every 500ms
- Progress File: JSON file tracks done/total/logs
Progress tracking files:
ct/admin/temp/galleryimportprogress.json- Current statusct/admin/temp/galleryimportdata- Raw import datact/admin/temp/galleryimportxlat- Field mappings (serialized)ct/admin/temp/galleryimportopts.json- Import options
Step-by-Step Usage
Task 1: Basic CSV Import
This workflow imports galleries from simple CSV data with URL, category, and description.
Steps:
- Navigate to Admin Panel → Galleries → Bulk Import
- Configure field mappings:
- Column 1: Select "Url"
- Column 2: Select "Category"
- Column 3: Select "Description"
- Click Add Column for additional fields
- Paste your CSV data in the textarea:
http://example.com/gallery1,Amateurs,Hot amateur gallery
http://example.com/gallery2,Brunettes,Stunning brunette photos
- Verify delimiter is set correctly (comma, tab, etc.)
- Set Accept to "Approved" or "Pending"
- Check Fast scan for quick import
- Click Preview Import
- Review the preview table showing parsed data
- Click Confirm & Start Import
- Monitor real-time progress bar and log messages
Result: Galleries are added to tblTgp with specified status.
[Screenshot: comus-add-progress-screen]
Task 2: Import with Model Association
Steps:
- Add a column mapping for field #29 (Model)
- Include model names in your CSV:
http://example.com/gallery1,Amateurs,Description,Jane Doe,Anna Smith
- Models in the Model column can be comma-separated
- Run the import
Result: Galleries are created AND linked to models via tblGalleryModels.
Task 3: Using Saved Playlists
Steps:
- Configure all field mappings and options
- Enter a playlist name (e.g., "TGP Network A")
- Click Save
- For future imports, select the playlist from the dropdown
- Settings are automatically loaded
- Paste new data and proceed with import
Progress Interface
During import, the progress interface displays:
Progress Bar
- Animated striped bar showing percentage complete
- Percentage text (e.g., "45%")
Status Line
- Shows "Processed X of Y" count
- Indicates "Complete" when finished
Log Panel
- Scrollable list of import events
- Color-coded messages:
- Green: Success messages
- Yellow: Warnings
- Red: Errors
Statistics Cards
Navigation Buttons
- Admin Home: Return to dashboard
- New Import: Start a fresh import
[Screenshot: comus-add-progress-stats]
Error Messages & Troubleshooting
Common Errors
Troubleshooting
Problem: Import stalls at 0%
Solution:
- Check browser console for JavaScript errors
- Verify
ct/admin/temp/folder exists and is writable - Check
ct/logs/galleryadd.logfor PHP errors
Problem: Thumbnails not saving
Solution:
- Verify
ct/thumbs/folder exists with write permissions - Check if thumbnail URLs are accessible
- Review log for cURL errors
Problem: Models not linking
Solution:
- Verify column is mapped to field #29 (Model)
- Check model names match exactly (case-sensitive)
- Review log for model creation messages
Problem: Progress bar shows but logs are empty
Solution:
- Session may have expired; re-login
- Progress JSON file may be corrupted; delete temp files and retry
Related Pages
- Gallery Review (
ct/admin/admin.php) - Manage imported galleries - Models (
ct/admin/models.php) - Manage model records - Categories (
ct/admin/categories.php) - Manage category list
Tips & Best Practices
Use Fast Scan for trusted sources: If importing from a known-good source, enable Fast scan to skip URL validation and dramatically speed up imports.
Create playlists for each source: Save time by creating dedicated playlists for each data source you regularly import from.
Test with small batches first: Before importing thousands of entries, test with 5-10 rows to verify field mappings are correct.
Avoid special characters in descriptions: Commas, quotes, and backslashes in description fields can break CSV parsing. Use tab delimiter or clean data first.
Check logs after import: Always review
ct/admin/log_viewer.php after large imports to identify any issues.