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

Imager trying to load image file that hasn't been transformed yet #300

Open
martinhellwagner opened this issue Oct 16, 2020 · 3 comments
Open

Comments

@martinhellwagner
Copy link

martinhellwagner commented Oct 16, 2020

In our Sentry, we're periodically seeing errors where Imager (or rather Color Thief, upon a function call triggered by Imager) is trying to load an image file that hasn't been transformed yet. This triggers a Runtime Exception as well as a 500 Server Error for the first user to visit the site. All subsequent visits (when the image has been transformed) work without problems.

Is it possible that a check is missing which determines whether or not the image has been transformed and can be processed further?

We are querying the dominant color in our Twig like so:

    {# -- Dominant Color (use last image from final images) -- #}
    {% if transformedImages | last and (transformedImages | last).url %}
        {% set dominantColor = craft.imager.getDominantColor((transformedImages | last).url, 10) %}
    {% endif %}

Everything else is done in Imager (see Stack Trace in the screenshot below):

Screenshot 2020-10-16 at 14 38 41

@aelvan
Copy link
Owner

aelvan commented Oct 16, 2020

What is transformedImages?

@martinhellwagner
Copy link
Author

martinhellwagner commented Oct 16, 2020

My apologies, forgot to include this line of code:

    {# -- Final Image Set -- #}
    {% set transformedImages = craft.imager.transformImage(image, sizes, imageSettings) %}

Basically transformedImages is what we're getting back from imager when calling the transformImage function for a certain image.

@martinhellwagner
Copy link
Author

@aelvan

Do you have any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants