Answer the question
In order to leave comments, you need to log in
How to themize an image field in Drupal 7?
Hello colleagues, tell me who came across how to themize the image field in the seventh (7.41) Drupal?
I know this is done by creating a file like field--FIELD_MYIMAGE.tpl.php
But here's the catch, all I've been able to dig up in the field module files is primitive type inference:
<?php foreach ($items as $delta => $item): ?>
<?php print render($item); ?>
<?php endforeach; ?>
<img...
<div class="field field-name-field-image field-type-image field-label-hidden">
<div class="field-items">
<div class="field-item even" rel="og:image rdfs:seeAlso" resource="my.jpg">
<img typeof="foaf:Image" src="my.jpg">
</div>
</div>
</div>
<div class="field field-name-field-image field-type-image field-label-hidden">
<div class="field-items">
<div class="field-item style="background-image: url('my.jpg');">
</div>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
detailed where the img tag itself is set,
you need above the line `<?php print render($item); ?>`
view this variable. enable the Devel module and use the variable lookup function
`dpm($item);
and having learned that instead of `render...` you can do any code like
` `
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question