Open rogertinch opened 5 years ago
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?
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?
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.
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?
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.
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