Skip to main content

Partial Image Matching - Speed Up Image Processing for Large Media Libraries

Speed up image processing for sites with large media libraries by controlling how LPagery searches for images.

Niklas avatar
Written by Niklas
Updated over 2 weeks ago

What is Partial Image Matching?

When LPagery processes images, it needs to find matching files in your WordPress Media Library.

By default, Partial Image Matching is enabled. This allows flexible substring matching, meaning LPagery can resolve images even if the filename in your source data is not an exact match.

ℹ️ Filenames with -scaled are treated the same as their non-scaled versions.


Examples (Partial Matching Enabled)

Input value → matched files

  • beach
    beach.jpg, sunny-beach.png, beach-scaled.jpg, uploads/2023/beach.jpeg

  • mountain
    mountain.png, mountain-scaled.png, alps-mountain-photo.jpg

  • hotel-exterior
    hotel-exterior.jpg, hotel-exterior-scaled.jpg

This flexibility is convenient, but on sites with thousands of images, it can slow down image processing because LPagery must scan many filenames.


When to Disable Partial Image Matching

Disable this setting if:

  • Your media library contains 10,000+ images and image processing is slow

  • You always use exact filenames in your source data (e.g. beach.jpg instead of beach)

  • You want maximum page creation performance


Behavior When Disabled

When Partial Image Matching is disabled, only exact filename matches are allowed.
-scaled and non-scaled versions are still treated as identical.

Examples:

  • forest.png → ✅ matches forest.png

  • forest → ✅ matches forest.png (extension optional)

  • FOREST.PNG → ✅ matches forest.png (case-insensitive)

  • forest → ❌ does not match deep-forest.png

  • hotel-exterior → ❌ does not match hotel-exterior-scaled.jpg


How to Configure

  1. Go to LPagery → Settings

  2. Ensure Image Processing is enabled

  3. Toggle Partial Image Matching on or off

  4. Click Save Settings

ℹ️ The Partial Image Matching toggle only appears when Image Processing is enabled.


Best Practices

Scenario

Recommendation

Small media library (< 1,000 images)

Keep enabled for flexibility

Large media library (10,000+ images)

Disable for better performance

Using exact filenames (forest.png, forest)

Can disable safely

Relying on partial matches (beachsunny-beach.jpg)

Keep enabled


Technical Details

When Partial Image Matching is disabled, LPagery uses an optimized lookup table with O(1) search performance instead of scanning the entire media library.

This lookup table is automatically kept in sync when images are uploaded or deleted, ensuring fast and reliable image resolution even on very large sites.

Did this answer your question?