0

right now I'm trying to echo an Array which could (possibly) have multiple nested Arrays inside them. I know this is probably a frequently asked question, but unfortunatly no answer I've read so far worked for me :(

My Array looks like this:

(
[FileName] => test.jpg
[FileDateTime] => 1550019186
[FileSize] => 78111
[FileType] => 2
[MimeType] => image/jpeg
[SectionsFound] => ANY_TAG, IFD0, EXIF, APP12, WINXP
[COMPUTED] => Array
    (
        [html] => width="876" height="815"
        [Height] => 815
        [Width] => 876
        [IsColor] => 1
        [ByteOrderMotorola] => 1
        [Copyright] => Test
    )

[ImageDescription] => Bild der Studie
[Artist] => Test
[Copyright] => Test
[Exif_IFD_Pointer] => 2210
[Title] => ???????????????
[Comments] => ???????
[Author] => ???
[Keywords] => ??????????????????
[Subject] => ???????
[UndefinedTag:0xEA1C] => �
[DateTimeOriginal] => 2019:02:13 21:03:07
[DateTimeDigitized] => 2019:02:13 21:03:07
[SubSecTimeOriginal] => 79
[SubSecTimeDigitized] => 79
[Company] => Ducky
[Info] => 
)

I've tried several code snippets like this, but none of them seem to work.

My Laravel Code looks like this:

<tr>
    <td>Exif Data</td>
    <td>
        <pre>
            @foreach($exifValues as $values)
                {{ print_r($values) }}
                @if(is_array($values))
                    @foreach($values as $value)
                        {{ print_r($value) }}
                    @endforeach
                @endif
            @endforeach
        </pre>
    </td>
</tr>

The table should look like this:

<table id="exif-table" class="table">
    <thead>
        <tr>
            <th scope="col">Name</th>
            <th scope="col">Wert</th>
            <th scope="col">Bearbeiten</th>
        </tr>
        <tr>
            <td>NAME</td>
            <td>VALUE</td>
            <td>(other Stuff)</td>
        </tr>
    </thead>
</table>

Or with actual Values from the Array I posted above:

<table id="exif-table" class="table">
    <thead>
        <tr>
            <th scope="col">Name</th>
            <th scope="col">Wert</th>
            <th scope="col">Bearbeiten</th>
        </tr>
        <tr>
            <td>FileName</td>
            <td>test.jpg</td>
            <td>(other Stuff)</td>
        </tr>
        <tr>
            <td>FileDateTime</td>
            <td>1550019186</td>
            <td>(other Stuff)</td>
        </tr>
        <tr>
            <td>FileSize</td>
            <td>78111</td>
            <td>(other Stuff)</td>
        </tr>
        <tr>
            <td>FileType</td>
            <td>2</td>
            <td>(other Stuff)</td>
        </tr>
    </thead>
</table>

Hope this helps.

Brecherchef
  • 401
  • 6
  • 22
  • What do you mean by not working? Print Nothing? Error Page? or what – Shiji.J Feb 13 '19 at 02:25
  • They're printing HTML which looks sort of like an array in HTML form since I used the `
    `-Tag. I want it to be in a table with a td around the name and the value but I can't seem to find out how to do it
    – Brecherchef Feb 13 '19 at 02:27
  • Watch the last minute of this tutorial https://m.youtube.com/watch?v=9csJMDGgZ6Q – estinamir Feb 13 '19 at 02:35
  • @bestinamir I've watched it, thank you for that. So I guess there is no way to just return the array to my view and use one small foreach loop to get all the data in one table? I have to echo out each entry individually? – Brecherchef Feb 13 '19 at 02:46
  • I guess so.. This image metadata looks too irregular for that.. – estinamir Feb 13 '19 at 03:00
  • can you show what the table should look like using your data – Kapitan Teemo Feb 13 '19 at 03:29
  • `print_r($exifValues)` should do what you are asking (ie, print out a nested array). So since you aren't dong that, I assume you want to print out the data in some specialized format like a table. Can you specify exactly what you are trying to do? – chiliNUT Feb 13 '19 at 04:38
  • @chiliNUT I've edited my Post above to show what the table should look like. :) I've tried `print_r()`. I could use this and argue that It's not possible to show the data in a clean table, if there actually is no way to do this wi.thout implementing every value individually – Brecherchef Feb 13 '19 at 04:41

0 Answers0