Media Processing & Recovery

Image Sideloading: Synchronous vs Asynchronous Queue

Comparison of real-time inline sideloading vs high-speed decoupled background queue processing.

Frexten Engineering Team
Updated 2026-11-20

Article Overview

  • Category: Media Handling, Performance & Storage Optimization
  • Audience: Site Owners, WooCommerce Store Managers, Developers, and Technical Support
  • Applies To: NextGen Smart Data Importer (Community Free & Enterprise Pro Editions)

1. Introduction: How NextGen Handles Media & Image URLs

When migrating websites or importing supplier catalogs, spreadsheets often contain image columns with external URLs:

text
https://images.example.com/products/summer-tshirt-blue.jpg

NextGen Smart Data Importer offers two distinct image processing architectures:

  1. Synchronous Sideloading Mode: Real-time, inline downloading during each row’s creation (Default in Free & Pro toggle).
  2. Asynchronous Background Queue Mode: Non-blocking, decoupled downloading via background workers (Enterprise Pro Feature).
Architecture Flowchart
flowchart TD Start["Spreadsheet Row with Image URL"] --> Decision{"Is 'Download Images Asynchronously' ON?"} Decision -- "NO (Synchronous Mode)" --> Sync["WordPress Core media_sideload_image()"] Sync --> DownloadNow["Download file immediately via HTTP"] DownloadNow --> Thumbnails["Generate Thumbnail / Medium / Large Sizes"] Thumbnails --> Attach["Attach to Post / Product immediately"] Attach --> NextRow["Proceed to Next Spreadsheet Row"] Decision -- "YES (Pro Asynchronous Mode)" --> Queue["Insert URL into wp_nextgen_image_queue"] Queue --> FastNext["Instant Row Completion (Up to 50x Faster)"] FastNext --> BackgroundJob["Background Micro-Worker Processes Queue in Background"]

2. Synchronous Mode (When Async is Turned OFF or on Free Edition)

How It Works Under the Hood

In Synchronous Mode, the importer pauses the row insertion loop until the image is 100% downloaded, cropped, and saved to the database:

  1. URL Resolution & Redirect Handling:
    • Checks the image URL and resolves redirects (e.g. tracking links or CDN shortlinks) to locate the true binary file and extension (.jpg, .png, .webp, .avif).
  2. Collision Evaluation:
    • Determines whether to reuse an existing image, replace it, or force a new copy (see Collision Behavior section below).
  3. Core Sideloading via Native WordPress API:
    • Invokes WordPress core functions: media_sideload_image() from wp-admin/includes/media.php, file.php, and image.php.
    • WordPress downloads the remote file directly to /wp-content/uploads/YYYY/MM/.
    • WordPress automatically generates all registered responsive thumbnail sizes (Thumbnail, Medium, Large, and custom WooCommerce catalog sizes).
  4. Metadata & Entity Linking:
    • Sets the image as the Featured Image (_thumbnail_id) or appends it to the WooCommerce Product Gallery (_product_image_gallery).
    • Writes mapped Alt Text, Image Title, Caption, and Description directly into wp_postmeta and wp_posts.
  5. Entity Tracking for Rollback:
    • Tracks the generated Attachment ID in the session log so that if you run a 1-Click Rollback, the image file and its attachments are completely cleaned up without leaving orphaned files on your server.

Pros & Cons of Synchronous Mode:

  • ✅ Immediate Completeness: The moment the import progress bar reaches 100%, every image is already downloaded, linked, and visible to site visitors.
  • ⚠️ Slower Import Velocity: Every spreadsheet row must wait for remote HTTP network latency and thumbnail generation before advancing.
  • ⚠️ Server Timeout Exposure on Massive Files: If you are importing 5,000 products on budget shared hosting with 10 MB images, synchronous downloads can encounter PHP max_execution_time limits.

3. Asynchronous Mode (Enterprise Pro Feature)

How It Works Under the Hood

In Asynchronous Mode, the importer decouples heavy network downloads from primary database record creation:

  1. Lightweight Queueing:
    • During the batch import, the importer creates the post/product record and writes a lightweight pending job to the wp_nextgen_image_queue database table:
sql
INSERT INTO wp_nextgen_image_queue (import_id, post_id, image_url, image_type, media_meta, status)
     VALUES (101, 4520, 'https://supplier.com/item.jpg', 'featured', '{"alt":"Blue Shirt"}', 'pending');
  1. 50x Faster Primary Import:
    • Instead of waiting 3 to 5 seconds per image, each product record is created in under 20 milliseconds.
    • A 10,000-product catalog that would take 4 hours synchronously finishes primary record insertion in under 6 minutes.
  2. Background Download Engine:
    • A dedicated background worker (triggered via WP-Cron or tokenized micro-batches) fetches pending images in the background.
    • As images finish downloading, they automatically attach to their respective products and generate responsive thumbnails without impacting front-end site performance or admin user interfaces.

4. Understanding Collision Behavior Settings

When importing files repeatedly, you will inevitably encounter images with filenames that already exist in your WordPress Media Library. NextGen provides three collision strategies:

Collision Mode Behavior Best Used When
Use Existing Media (Fastest - MD5 Check) (Pro) Checks the media library by filename and MD5 URL hash. If a match exists, it reuses the existing Attachment ID without re-downloading. Daily inventory/pricing feeds. Prevents duplicating images, saves disk space, and speeds up syncs by up to 90%.
Overwrite / Replace Media Image Deletes the old attachment and its cropped thumbnails from disk and replaces it with the newly downloaded file. Product catalog refreshes where suppliers keep identical filenames but update the actual product photo.
Always Create As New Image Bypasses collision checks and saves the file with an incremental suffix (e.g. product-1.jpg, product-2.jpg). Multi-vendor catalogs where multiple unique products share common filenames (e.g. front.jpg).

5. Frequently Asked Questions (FAQ) for Customers & Support

Q1: If I turn OFF Asynchronous Downloading, will my images still be imported?

Yes, 100%. Turning Asynchronous Downloading OFF simply instructs NextGen to download images immediately (synchronously) during each row's creation. When the import completes, all images are fully downloaded and attached.

Q2: Why is my import taking longer when Asynchronous Downloading is OFF?

In synchronous mode, the speed of your import depends on:

  1. The network speed of the remote server hosting the images.
  2. The size of the image files (e.g. 500 KB vs. 8 MB).
  3. How many thumbnail sizes your active theme and plugins register (WordPress typically crops 5 to 10 thumbnail sizes for each uploaded image).
    Tip: To make imports up to 50x faster, enable Download Images Asynchronously in NextGen Pro.

Q3: What happens if a remote image URL is broken (404 Not Found)?

In both Synchronous and Asynchronous modes, NextGen will log the broken image error in the session log, skip the invalid image, and continue importing the rest of your product data without crashing the import session.

By default, if "Download External Images to Media Library" is enabled, NextGen downloads all images directly to your /wp-content/uploads/ directory so your site is 100% self-hosted and independent.
If you prefer zero disk consumption, you can use our built-in External CDN / FIFU integration to display external images without storing them on your server.

Q5: Can I extract images embedded inside article HTML content?

Yes. With NextGen Pro’s Inline Content Image Sideloading, the importer scans post_content for <img> tags, downloads the images into your Media Library, and automatically rewrites the HTML URLs to point to your local WordPress installation.


Document Version: 1.0.0
Target: NextGen Customer Knowledge Base & FAQ Portal
Author: NextGen Technical Architecture & Customer Success Team