Skip to content

In specific circumstances, thumbnail previews are not showing when using SharpImageTransform #5

@adrienne

Description

@adrienne

Describe the bug

When we first upload a new image into a Matrix field, and before we have Saved the entry, we get our "not found" placeholder. This definitely does not happen with ImageOptimize's normal CraftImageTransform class.

This seems to be specific to:
a) Matrix blocks
b) where the Assets field uses a Twig expression including {{ owner.[something] }} to restrict the folder

I tested, and Asset fields inside Matrix blocks in general work fine, as do non-Matrix Asset fields that use a Twig expression.

I know there were some vaguely recent changes to thumbnailing behavior by Craft itself (I had to report a bug to Craft about their thumbnail handling about a month ago), so I wonder if something isn't hooking together correctly?

To reproduce

Steps to reproduce the behaviour:

  1. Create a Matrix field
  2. Create a block type
  3. Create an asset field in your block
  4. Set the Asset field's Default Asset Location to {{owner.site.handle}}
  5. Make sure "Allow uploading directly to the field" is checked on the Asset field
  6. Add your Matrix field to a section, then try uploading a new photo directly using "Upload a File"

Expected behaviour

The actual image thumbnail should show as soon as the image is uploaded, instead of showing our "not found" placeholder.

Screenshots

image

Versions

  • Plugin version: ImageOptimize 1.6.38
  • Craft version: Craft Pro 3.7.26

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions