Skip to content
Back to Articles

PrestaShop Product Images: audit, URLs and an import workflow without broken images

Product image imports, migrations & catalogue QA
HTTP
POST /api/images/products/42

Content-Type:
multipart/form-data

image=@product-main.jpg

VERIFY → REORDER → CLEANUP
Import & Export
Intermediate
PrestaHacks 3 min read

You have 4,000 products and a column called image_url. That does not mean you have 4,000 import-ready product images.

A reliable image workflow validates associations, availability, format, ordering, duplicates and failures.

1. The source URL is input

TEXT
https://supplier.example/images/ABC001.jpg

Before import ask: does it exist, is it really an image, is it public, is the URL temporary and which SKU does it belong to?

2. Image mapping

SKU Image URL Position Cover
ABC-001 .../abc001-1.jpg 1 1
ABC-001 .../abc001-2.jpg 2 0
ABC-002 .../abc002.jpg 1 1

3. One product can have many images

Treat them as ordered records, not as an unstructured list of URLs.

4. Products without image associations

SQL
SELECT
    p.id_product,
    p.reference,
    pl.name
FROM ps_product p
INNER JOIN ps_product_lang pl
    ON pl.id_product = p.id_product
    AND pl.id_lang = 1
    AND pl.id_shop = 1
LEFT JOIN ps_image i
    ON i.id_product = p.id_product
WHERE p.active = 1
GROUP BY p.id_product, p.reference, pl.name
HAVING COUNT(i.id_image) = 0
ORDER BY pl.name;

5. Count images per product

SQL
SELECT
    p.id_product,
    p.reference,
    COUNT(i.id_image) AS image_count
FROM ps_product p
LEFT JOIN ps_image i
    ON i.id_product = p.id_product
GROUP BY p.id_product, p.reference
ORDER BY image_count ASC;

6. Validate remote URLs

TEXT
IMAGE URL
   ↓
HTTP CHECK
   ↓
CONTENT TYPE
   ↓
SIZE
   ↓
VALID / INVALID

Supplier URLs may expire, require sessions, contain signed query strings or block automated requests.

7. Duplicate URLs and cover rules

Check the same URL mapped to multiple SKUs and define a deterministic cover rule, for example position 1 = cover.

8. RAW and READY

TEXT
RAW_IMAGE_URLS
       ↓
VALIDATE
       ↓
NORMALIZE
       ↓
ASSOCIATE SKU
       ↓
ORDER
       ↓
READY_FOR_IMPORT

9. Post-import audit

Compare expected image counts with actual imported counts and produce a REVIEW/FAIL report.

Images are data: they have identifiers, associations, ordering and validation rules.

Next step

Add image validation to the supplier-feed transformation pipeline, before producing the final import file. Preserve the expected image count and URL status alongside the CSV product import log so post-import reconciliation is measurable.

STAY TUNED

Get practical PrestaShop hacks in your inbox.

INACTIVE