Jump to content

[SOLVED] exif problems


richard_PHP

Recommended Posts

hello all, back with a new problem.

 

scenario: im wanting to display clickable thumbnails of jpegs located in a directory. ive found some code for it but after testing it, found it doesnt work and displays the following message:

 

Warning: exif_read_data() [function.exif-read-data]: Unable to open file in

Warning: exif_thumbnail(uploads) [function.exif-thumbnail]: File not supported

 

heres the code:

 

<?php
// define directory path
$dir = "uploads/";

// iterate through files
// look for JPEGs
if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            if (preg_match("/.jpg/", $file)) {
                // read Exchangeable Image File (EXIF) headers for info
                $exif = exif_read_data($file, 0, true);
                echo "<tr>";
                // get thumbnail
                // link to full image
                echo "<td valign=top><a href=$dir/$file><imgsrc=thumbnail.php?file=$file></a><td>";
                echo "<td valign=top><font size=-1>";
                // get file name
                echo "File: <b>" . $exif['FILE']['FileName'] . "</b><br/>";
                // get timestamp
                echo "Timestamp: "  . $exif['IFD0']['DateTime'] . "<br/>";
                // get image dimensions
                echo "Dimensions: " . $exif['COMPUTED']['Height'] . " x " . $exif['COMPUTED']['Height'] . " <br/>";
                // get camera make and model
                echo "Camera: " . $exif['IFD0']['Model'];
                echo "</font></td>";
                echo "</tr>";
			$image = exif_thumbnail($dir . "/" . $_GET['file']);
header("Content-Type: image/jpeg");
echo $image;
           }
        }
       closedir($dh);
   }
}
?>

 

i appreciate all help and also if anyone has working code i would appreciate (and will reference) the code. many thanks!

Link to comment
https://forums.phpfreaks.com/topic/155544-solved-exif-problems/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.