0

I have a assets field in a Super Table.
But the output from the image i selected in the Entry is just garbage:

O:28:"craft\elements\db\AssetQuery":82:{s:8:"volumeId";N;s:8:"folderId";N;s:8:"filename";N;s:4:"kind";N;s:5:"width";N;s:6:"height";N;s:4:"size";N;s:12:"dateModified";N;s:17:"includeSubfolders";b:0;s:14:"withTransforms";N;s:11:"elementType";s:20:"craft\elements\Asset";s:5:"query";N;s:8:"subQuery";N;s:12:"contentTable";s:12:"{{%content}}";s:12:"customFields";N;s:9:"inReverse";b:0;s:7:"asArray";b:0;s:6:"drafts";b:0;s:7:"draftId";N;s:7:"draftOf";N;s:12:"draftCreator";N;s:9:"revisions";b:0;s:10:"revisionId";N;s:10:"revisionOf";N;s:15:"revisionCreator";N;s:2:"id";N;s:3:"uid";N;s:10:"fixedOrder";b:0;s:6:"status";a:1:{i:0;s:7:"enabled";}s:8:"archived";b:0;s:7:"trashed";b:0;s:11:"dateCreated";N;s:11:"dateUpdated";N;s:6:"siteId";s:1:"*";s:6:"unique";b:1;s:11:"preferSites";a:1:{i:0;i:1;}s:14:"enabledForSite";b:1;s:6:"leaves";b:0;s:9:"relatedTo";N;s:5:"title";N;s:4:"slug";N;s:3:"uri";N;s:6:"search";N;s:3:"ref";N;s:4:"with";N;s:7:"orderBy";a:1:{s:19:"relations.sortOrder";i:4;}s:13:"withStructure";N;s:11:"structureId";N;s:5:"level";N;s:14:"hasDescendants";N;s:10:"ancestorOf";N;s:12:"ancestorDist";N;s:12:"descendantOf";N;s:14:"descendantDist";N;s:9:"siblingOf";N;s:13:"prevSiblingOf";N;s:13:"nextSiblingOf";N;s:16:"positionedBefore";N;s:15:"positionedAfter";N;s:17:"*defaultOrderBy";a:1:{s:20:"elements.dateCreated";i:3;}s:39:"craft\elements\db\ElementQuery_result";N;s:47:"craft\elements\db\ElementQuery_resultCriteria";N;s:45:"craft\elements\db\ElementQuery_searchScores";N;s:6:"select";a:1:{s:2:"**";s:2:"**";}s:12:"selectOption";N;s:8:"distinct";N;s:4:"from";N;s:7:"groupBy";N;s:4:"join";a:1:{i:0;a:3:{i:0;s:10:"INNER JOIN";i:1;s:24:"{{%relations}} relations";i:2;a:4:{i:0;s:3:"and";i:1;s:40:"[[relations.targetId]] = [[elements.id]]";i:2;a:2:{s:18:"relations.sourceId";s:3:"553";s:17:"relations.fieldId";s:2:"13";}i:3;a:3:{i:0;s:2:"or";i:1;a:1:{s:22:"relations.sourceSiteId";N;}i:2;a:1:{s:22:"relations.sourceSiteId";s:1:"1";}}}}}s:6:"having";N;s:5:"union";N;s:6:"params";a:0:{}s:18:"queryCacheDuration";N;s:20:"queryCacheDependency";N;s:27:"yii\base\Component_events";a:0:{}s:35:"yii\base\Component_eventWildcards";a:0:{}s:30:"yii\base\Component_behaviors";a:1:{s:12:"customFields";O:36:"craft\behaviors\ElementQueryBehavior":15:{s:8:"mainText";N;s:12:"previewImage";N;s:10:"textImages";N;s:5:"test1";N;s:8:"textBild";N;s:13:"textBildWidth";N;s:14:"textBildHeight";N;s:9:"textImage";N;s:14:"textImageWitdh";N;s:10:"categories";N;s:9:"entryType";N;s:10:"shortTitle";N;s:11:"previewText";N;s:51:"craft\behaviors\ContentBehavior_customFieldValues";a:0:{}s:5:"owner";r:1;}}s:5:"where";N;s:5:"limit";s:1:"1";s:6:"offset";N;s:7:"indexBy";N;s:16:"emulateExecution";b:0;}
666

A number field for example (the 666 at the end i have in textImageWitdh) works.
The code is just:

{% for entry in craft.entries.section('blog').level(1) %}

  <h2 class="under">{{ entry.title }}</h2>
  {{ entry.getLink() }}
  {{ entry.previewText |raw }}
  {% for row in entry.textImages.all() %}
    {{ row.textImage }}
    <br />
    {{ row.textImageWitdh }}
  {% endfor %}

{% endfor %}

The entry: enter image description here The Super Table: enter image description here

3
  • Can you take a screenshot of your supertable setup? Your code doesn't show an image?
    – dmatthams
    Commented Jul 16, 2019 at 11:07
  • If i can find out how to make a screenshot. Since years I'm using Pearl Crescent Page Saver in Firefox. But in the Craft admin panel it captures only whats visible and not the whole site.. Commented Jul 16, 2019 at 20:38
  • @user3788089, screenshot is there. Commented Jul 17, 2019 at 5:32

1 Answer 1

0

Ah ok, two issues;

  1. the image field is an array so you need to just select the first
  2. you need an 'img' html tag as the twig code will only output the url
{% for entry in craft.entries.section('blog').level(1) %}

  <h2 class="under">{{ entry.title }}</h2>
  {{ entry.getLink() }}
  {{ entry.previewText |raw }}
  {% for row in entry.textImages.all() %}
    <img src="{{ row.textImage.one().url() }}">
    <br />
    {{ row.textImageWitdh }}
  {% endfor %}

{% endfor %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.