huseyin Posted July 12, 2020 Share Posted July 12, 2020 Hello, i use PW 3.0.148 0n local XAMPP. It works like this when i have single image field : $page->image->size(z,y)->url But as soon as i have multiple images field and add "first" or "first()" or "eq(0)" than i get no output. ERROR : $page->image->eq(0)->size(z,y)->url WORKS : $page->image->eq(0)->url Can anybody reproduce this and find the reason? Link to comment Share on other sites More sharing options...
elabx Posted July 12, 2020 Share Posted July 12, 2020 How is your inputfield's formatted value configured? try setting it to be formatted as a single item. 1 Link to comment Share on other sites More sharing options...
huseyin Posted July 12, 2020 Author Share Posted July 12, 2020 I have 2 fields one is single item, the other is multiple items. With the single item field it works. But i need also the other multiple items field and with the multiple items field it should work also.. Link to comment Share on other sites More sharing options...
fliwire Posted July 12, 2020 Share Posted July 12, 2020 you need to check images count if(count($page->images)) { // the page has one or more images } https://processwire.com/docs/fields/images/https://processwire.com/api/ref/page/if/ 1 Link to comment Share on other sites More sharing options...
huseyin Posted July 13, 2020 Author Share Posted July 13, 2020 So sorry. while checking i realized the field was "file" instead "image". Corrected this and it works now. Sorry again and thank you for your effort. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now