Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter darko0507

    (@darko0507)

    Hi Mateusz,

    Thanks for the detailed explanation. I understand the content negotiation flow (AVIF if supported, otherwise WebP, otherwise original) and that your plugin stores converted files under /wp-content/uploads-webpc/ without modifying or deleting originals.

    Here is the exact problem on my side, with concrete findings.

    1. WordPress DB contains 16,937 image attachments (attachment records with _wp_attached_file). Many of those _wp_attached_file values point to a file that does not exist on disk under wp-content/uploads.

    So the site serves an image fine, but the original file referenced by _wp_attached_file is missing from uploads.

    1. In uploads-webpc I do see many files in the form filename.jpg.webp, but not for every missing original. When I reconcile DB vs local files I end up with:
    • Total DB rows: 16937
    • FOUND_EXACT: 967
    • FOUND_OTHER_EXT (matches to .jpg.webp): 2832
    • FOUND_FAMILY_VARIANT (found resized family): 6407
    • missing on disk: 6731

    The key point is that many of these missing attachments are still accessible via HTTP and are served as WebP, even though the expected original file is not present in uploads.

    This is why I asked about “a consistent way to locate the actual source image file that corresponds to each attachment record”.

    My automation workflow today is:

    • export attachment list (attachment_id + _wp_attached_file + alt)
    • download wp-content/uploads and wp-content/uploads-webpc via FTP
    • process local files to generate alt text

    But because the file referenced by _wp_attached_file is often not present in uploads, I need a deterministic mapping.

    Questions:

    1. When the original file referenced by _wp_attached_file is missing in uploads, how does the plugin decide what is the “equivalent of the original image” to convert and serve? Does it use the largest available resized variant, or does it rely on some other source?
    2. Is there any built-in method, hook, CLI, or internal function that can return the actual served file path (WebP/AVIF) for a given attachment ID or _wp_attached_file value?
    3. If uploads-webpc does not contain a WebP for a given missing original, where can the plugin serve the WebP from? Only uploads-webpc, or could it also serve from cache or another location?

    I realize another plugin or hosting cache could be involved, but the consistent behavior (URL .jpg served as image/webp) and the presence of many filename.jpg.webp files suggests the conversion layer is central to what I am observing.

    Best regards,

Viewing 1 replies (of 1 total)