Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.