Hello
I want to add a class to a specifc image out of many images which i loaded from a folder.
I did that like it is provided:
<?php foreach ($page->images()->offset(1) as $image): ?>
<li>
<figure class="imageColumn">
<img class="imgContainer <?= $image->class() ?>" src="<?= $image->url() ?>">
</figure>
</li>
<?php endforeach ?>
Like the code says, the img should grap the text form the field “class”
There is the img
and the .txt
named after the img
. In this .txt
there is a field says class: someclass
.
So it should work, right?
But it is not loading anything from the meta data:
What is wrong here? Any Ideas?
So none of these images has a class attached?
Can’t see anything wrong with the code, but you said you want to get only one image, but here you are looping through a collection of images?
I am loading a group of images and i want to add a class specific images out of this group. I thought the meta data files are the best way to do so.
And, yes. None of this images is loading any infomation from the text file. I already tried to fill the alt tag. Also not working.
Hm, that weird. Sure the meta data files exist?
Yes, pretty shure:
and here from the inside:
But your project wasa multi language installation, right? Then the meta data files should have the language extension as well.
1 Like
Nice! You are totally right!
With the .de.txt
or .en.txt
it works.