Documentation · Troubleshooting
Image Import Errors
This document covers failures that can occur when the plugin downloads and attaches vehicle images from the AutoScout24 API. It describes likely causes and the steps to diagnose and resolve media import problems.
When to use this document
Read this document when:
- Vehicle posts are imported but have no images or only a partial set of images.
- The plugin log contains lines mentioning
Image download failedormedia_handle_sideload failed. - The featured image is missing from imported vehicle posts.
- WebP conversion is enabled but images are saved in their original format.
- The image queue worker has been running but images are still missing.
Overview
When the plugin imports a vehicle, it downloads images from the URLs provided by the AutoScout24 API and attaches them to the WordPress post. The process uses WordPress's built-in download_url() and media_handle_sideload() functions, which place images in the standard WordPress uploads directory, generate thumbnails and register the attachment in the media library.
Deduplication
Before downloading an image, the plugin checks whether it has already been imported by looking for an attachment with a matching _as24ci_source_url post meta value. If a match is found, the existing attachment ID is reused and no download occurs. This prevents the same image from being stored multiple times.
Featured image
The first image in the set is automatically set as the featured image (post thumbnail) if no featured image is already assigned to the post. Subsequent images are recorded in the _as24ci_image_ids post meta array.
Image queue mode
When image queue mode is enabled (the default for cron and REST import runs), only the first image per vehicle is downloaded immediately during the import run. Remaining image URLs are placed in a persistent queue. A separate WP-Cron worker (as24ci_image_queue_process) processes this queue asynchronously in batches of 30 images per run. This reduces the time and memory required per import run.
See Cron Errors for guidance on diagnosing image queue worker failures.
WebP conversion
If WebP conversion is enabled, each downloaded image is converted to .webp format before being passed to the WordPress media library. The plugin attempts conversion using PHP GD (imagewebp) first, then falls back to Imagick. If neither extension is available, or if conversion fails, the original image format is used and a warning is written to the log.
Prerequisites
- API connection is working and images are present on the AutoScout24 listing. Verify this on the System Status page.
- The WordPress uploads directory is writable by the web server process.
- The Import images option is enabled in the plugin settings.
- PHP memory limit and execution time are sufficient for downloading and processing images.
Diagnostic steps
Step 1: Confirm image import is enabled
- Go to the plugin Settings tab (or Import & Limits depending on layout).
- Confirm Import images is enabled.
- Note the Max images per vehicle value. If set to a low number (for example
1), only that many images will be downloaded per vehicle. Set it to0for unlimited.
Step 2: Read the log file
Open the plugin log file at:
wp-content/uploads/as24ci-logs/adp-car-market-hub.log
Search for the following patterns:
| Log pattern | Meaning |
|---|---|
Image download failed for listing_id=… url=… error=… | download_url() returned an error. The error message includes the cause (e.g. HTTP timeout, connection refused, 404). |
media_handle_sideload failed for listing_id=… url=… error=… | WordPress could not register the downloaded file as a media attachment. Often a file system permission or disk space issue. |
WebP conversion skipped: neither GD imagewebp nor Imagick available. | WebP conversion is enabled but the required PHP extension is not present. |
WebP GD conversion failed for …, trying Imagick. | GD failed; Imagick will be attempted as a fallback. |
WebP Imagick conversion failed: … | Both conversion methods failed. The original image format was saved. |
WebP conversion failed for …, using original. | Final fallback: original image saved. |
Image queue worker: processed=… errors=… remaining=… | Summary of the last image queue worker run. |
Image queue worker error post_id=… url=… error=… | An individual image failed inside the queue worker. |
Step 3: Verify the uploads directory
The WordPress uploads directory must be writable by the web server. Typical location:
wp-content/uploads/
Check via FTP, SFTP or the hosting file manager that:
- The directory exists.
- The web server process has write permission (typically
755for directories, with the web server user as owner). - Sufficient disk space is available.
If the uploads directory is not writable, media_handle_sideload will fail with a file system error.
Step 4: Check PHP memory and execution limits
Downloading and processing multiple images in a single request requires adequate PHP memory. If the PHP memory limit is too low, image processing may fail silently or generate a fatal error.
- Check Tools → Site Health → Info → Server for the current PHP memory limit and maximum execution time.
- If the memory limit is below 256 MB for sites with large image files, consider increasing it via
wp-config.php(define('WP_MEMORY_LIMIT', '256M')) or the hosting control panel. - For cron runs, the plugin attempts to set a 300-second execution time limit. If the hosting environment restricts
set_time_limit, this may not take effect. Use the image queue mode (enabled by default) to spread image downloads across multiple shorter runs.
Step 5: Test image URL accessibility
If the log shows Image download failed with a network or HTTP error, verify that the image URLs returned by the API are publicly accessible from your server:
- Copy an image URL from the log entry.
- Try accessing it in a browser. If it returns a 404 or authentication error, the image may have been removed from the API or may require authentication that the plugin does not provide.
- If the URL is accessible in a browser but not from the server, there may be an IP allowlist, firewall, or proxy restriction on your server's outbound HTTP requests.
Step 6: Verify the image queue status
- Go to the plugin's System & Help tab.
- Look for the image queue section showing: items remaining, last run time, processed and failed counts.
- If items remain and the queue worker has not run recently, verify that WP-Cron is active and the
as24ci_image_queue_processhook is scheduled. See Cron Errors for details. - If the image queue lock (
as24ci_image_queue_running) is stale, delete it via WP-CLI or a transient management plugin: ``wp transient delete as24ci_image_queue_running``
Step 7: Check WebP conversion prerequisites
If WebP conversion is enabled but images are saved as JPEG or PNG:
- Go to Tools → Site Health → Info → Server and look for GD library and Imagick.
- GD requires the
imagewebpfunction, which is available in GD compiled with WebP support (PHP 5.5+). Confirm with your hosting provider. - Imagick requires the
imagickPHP extension with WebP support compiled in. Confirm with your hosting provider. - If neither is available, disable WebP conversion in the plugin settings or contact your hosting provider to enable the required extension.
Configuration reference
| Setting | Effect |
|---|---|
| Import images | Master switch. When disabled, no images are downloaded during import. Default: enabled. |
| Max images per vehicle | Maximum number of images downloaded per vehicle. 0 = unlimited. |
| Image queue mode | When enabled, only the first image is downloaded immediately; remaining images are queued. Default: enabled for cron/REST runs. |
| Convert to WebP | When enabled, downloaded images are converted to .webp format. Requires GD with WebP support or Imagick. Default: disabled. |
| WebP quality | Compression quality for WebP conversion (1–100). Default: 80. |
Operational notes
- Images are downloaded with a 30-second per-URL timeout. Slow or unreliable external image servers may cause individual images to fail without affecting the rest of the import.
- Each downloaded image is registered in the WordPress media library as an attachment with
post_parentset to the vehicle post ID. - The
_as24ci_source_urlattachment meta value is used for deduplication. If this meta is deleted or corrupted, the plugin may download the same image again on the next import. - The image queue can hold up to 20,000 items. If this limit is exceeded, a warning is logged and a deduplication pass runs. See Cron Errors.
- When all queue items for a vehicle have been processed, the
_as24ci_image_idsmeta is rebuilt from the actual child attachments and the images hash is finalised. Until then, the hash value is set topending_queueto signal that the image set is not yet complete. - Deleting a vehicle post permanently (via the plugin's delete function or from the WordPress Cars list) also permanently deletes all attached images imported by the plugin.
Troubleshooting
| Symptom | Likely cause | Check |
|---|---|---|
| No images on any vehicle | Import images is disabled | Enable in plugin settings |
| Only one image per vehicle | Max images is set to 1, or image queue has not run | Check max images setting; verify queue worker is running |
Image download failed … HTTP 404 | Image URL no longer valid | Verify listing still has images in AutoScout24; re-import |
Image download failed … connect timed out | Server cannot reach external image host | Check outbound network access; try from the server with curl |
media_handle_sideload failed … Could not write file | Uploads directory not writable or disk full | Check directory permissions and available disk space |
| WebP conversion silently skipped | GD/Imagick not available or not compiled with WebP support | Check Site Health → Server; disable WebP conversion if unsupported |
| Images present in media library but not on vehicle page | _as24ci_image_ids meta may be missing or incorrect | Re-import the vehicle; check the post meta in the database |
| Featured image missing | First image in queue may not yet be processed | Check image queue status; verify queue worker runs |
| Duplicate images in media library | _as24ci_source_url meta missing from attachments | Do not delete this meta; contact support if affected |