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

Image Transform Issue #53

Open
rogertinch opened this issue Apr 29, 2019 · 5 comments
Open

Image Transform Issue #53

rogertinch opened this issue Apr 29, 2019 · 5 comments

Comments

@rogertinch
Copy link

Does running an image transform inside of a Preparse Field work any differently to running it in a template? I'm encountering this issue when saving an entry that has a Preparse Field that applies a transform to an assets field:

yii\base\ErrorException: fopen(/srv/app/prod-crafthouse/htdocs/storage/runtime/assets/tempuploads/user_1/running-with-beto.jpg): failed to open stream: No such file or directory in /srv/app/prod-crafthouse/htdocs/vendor/league/flysystem/src/Adapter/Local.php:181

@aelvan
Copy link
Contributor

aelvan commented Apr 29, 2019

Well, that depends.. From the error message, it looks like the Asset has not been created yet, it's trying to transform an image in the tempuploads folder. Is the preparse field on the Asset or the Entry? Have you set up the field to parse before or after save? Is it a multi-site install?

@rogertinch
Copy link
Author

The preparse field is on the entry and the field is set to parse after save. It is not part of a multi-site install, but it is on fortrabbit's Pro Stack which doesn't have file storage.

In talking to fortrabbit they said that transforms in templates work fine on their Pro Stack, which points to Preparse Field maybe doing something different with the file before and after transforming?

@rogertinch
Copy link
Author

Oh, and here is what I have in the field:

{% spaceless %}
{% if element.heroImage | length %}
  {% set heroImage = element.heroImage.one() %}
  {{ heroImage.getUrl('landscape') }}
{% endif %}
{% endspaceless %}

This was working fine on their Uni Stack which has file storage.

@aelvan
Copy link
Contributor

aelvan commented Apr 29, 2019

I've tested in my test environments, and the setup you're describing works there.

The only thing Preparse Field maybe do differently, is changing the config setting generateTransformsBeforePageLoad to true before parsing the twig. Not sure how fortrabbit have adapted their platform to get the local copy of the files if there's no file system, but maybe that has something to do with it. Maybe they rely on the transform happening as a queue task?

Just as a test, try to set up the preparse field to parse before save (in the field settings). Does that change anything?

Also, what PHP-version are you using? Also, you get that error when you try to save? Or is it in your logs afterwards?

@rogertinch
Copy link
Author

Setting it to preparse before save did not fix the issue. I reached out to fortrabbit again along with note about they're handing local copies of the files on their Pro Stack.

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