Hi guys,
I tried to get filename of a picture -which is deposited in database- coding like this:
[
.
.
.
'value' => function($model) {
$vorname = Person::findOne([$model->id_person])->vorname;
$nachname = Person::findOne([$model->id_person])->nachname;
$matchcode = $vorname . "," . $nachname;
$bilder =LBild::findOne(['matchcode' => $matchcode]);
.
.
.
I noticed,that,
$ausgabe = array($bilder->dateiname);
var_dump($ausgabe);
shows up this:
array(1) { [0]=> string(28) "Passbild_Moi_Black_White.jpg"}array(1) { [0]=> string(16) "moi_large_sw.jpg"}
These are filenames of pictures,which I have in database and in folder frontend/web/pictures
I only need one of this filenames,not both.
So, I started complementing code like this, but I didn’t succeed…
$x = 0;
$pictures = array();
foreach ($bilder as $key => $val) {
$pictures[$x] = $bilder->dateiname;
$x++;
}
$output = array_slice($pictures, -14, 1);
var_dump() will show this, now:
array(1) { [0]=> string(28) "Passbild_Moi_Black_White.jpg"}array(1) { [0]=> string(16) "moi_large_sw.jpg"}
Any ideas, how to achieve,that var_dump() only will show up one single value,for instance like this:
string(28) "Passbild_Moi_Black_White.jpg"
It would be best, If I got an array like this:
array(2) { [0]=> string(28) "Passbild_Moi_Black_White.jpg"
[1]=> string(16) "moi_large_sw.jpg"
}