Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When Used with ACF/Timber/Twig there are PHP failures due to TimberImage process issues #14

Open
2 tasks done
timnolte opened this issue Jun 1, 2023 · 1 comment
Open
2 tasks done
Assignees
Labels
bug Something isn't working

Comments

@timnolte
Copy link
Member

timnolte commented Jun 1, 2023

Describe the bug
When pulling an image via the Timber/ACF integration in Twig the resulting image is the proxied source image URL instead of the current site URL, which fails to find the image from the Media Library. This causes the TimberImage processing to fail with a critical error.

To Reproduce
Steps to reproduce the behavior:

  1. Install, activate, configure the plugin.
  2. Navigate to a page that uses code such as:
<img src="{{TimberImage(post.get_field('profile_picture')).src|resize(280, 280)}}" />
  1. Observe a site critical error.

Expected behavior
Ideally the code shouldn't error out fatally but return a proper Twig image object that has a source of the proxy site.

Isolating the problem (mark completed items with an [x]):

  • I have deactivated other plugins and confirmed this bug occurs when only this plugin is active.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment

  • PHP Version: 8.0
  • WordPress Version: 6.2.2
  • Plugin Version: 1.1.1
@timnolte timnolte added the bug Something isn't working label Jun 1, 2023
@timnolte timnolte self-assigned this Jun 1, 2023
@timnolte
Copy link
Member Author

timnolte commented Jun 1, 2023

I discovered that it's because the image URL is replaced with the remote image and then when passed to the TimberImage function it can't find the image in the Media Library because the URL isn't in the database. There might be another hook I need to tap into that will ensure that the Timber function can properly find the item in the local Media Library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant