Cannot access exif information in file object

Hello everyone,

for my personal web page with mainly pictures from vacations with the family (mikulastik.de) I am trying to display the model of the camera each picture was taken with, but for some reason I cannot access the exif object.

This is my code:

<?php 
    $images = $page->images(); # $images is of type: files
    $thumbnails = $images->filterBy('filename', '*=', 'thumbnail.jpg');
    //echo "\n<br>thumbnails: ", $thumbnails, "<br>\n";
    $fullSize = $images->filterBy('filename', '*=', 'full.jpg');
    //echo "<br>fullsize: ", $fullSize, "<br>\n";
    $numImages = $fullSize->count();
    for ($i=0; $i<$numImages; $i++) {
        echo "<div id=\"thumbnail\"><a href=\"";
        echo $fullSize->nth($i)->url();
        echo "\"><img src=\"";
        echo $thumbnails->nth($i)->url();
        echo "\" alt=\"2014-12-09 um 20-07-24.jpg\" title=\"";
        $name = $thumbnails->nth($i)->name();
        echo preg_replace("/(.*)\.thumbnail/", "$1", $name);
        $file = $fullSize->nth($i);
        $exif = $file->exif();
        if ($exif)
            $camera = $exif->camera();
            $make = $camera->make();
            echo " mit ";
            echo $make;
            echo "\" /></a></div>";
        }				
?>

The $file object works fine. For the $file->$type it returns image. It also returns the correct width, but the exif object does not work. When I try to access it, I get an error message. I also checked, that my images really have exif information.

Does anyone have an idea what I’m doing wrong?

Thanks and greetings from Holland,
Patrick

Hi Patrick,

I guess you need to change the way to get the exif data. I am not sure if you can do it this way.

<? echo $image->exif()->camera()->model() ?> and <? echo date("d/m/Y", $image->exif()->timestamp()) ?> work for me…

Not sure if thumbs contain all the exif either. Better check with the original file.