Jump to content
Larry Ullman's Book Forums

Matt.F.

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by Matt.F.

  1. Now however I have a new problem. I want to display the thumbnail of the image and the EXIF data on one page. PHP doesn't like it.

     

    I can EITHER show the thumbnail when it executes the header statement

    header('Content-type: ' .image_type_to_mime_type($type));

    but then it does not show any EXIF data

     

    OR show the EXIF data by commenting out the header staement

    but then it shows the thumbnail as a series of weird characters, like

     

    1AQaq"2‘¡±B#ÁRÑð3$bár‚’CS

    etc etc.

     

    Any feedback appreciated!

    thanks,

    Matt

    <?php
    define('MYFILE', 'Avatars\Image17IR.jpg') ;
    
    $width = 0;
    $height = 0 ;
    $type = '' ;
    $imgdat = exif_thumbnail(MYFILE, $width, $height, $type);
    if ($imgdat!==false) {
        
        // when the 2 lines below are executed, the thumbnail is shown, but nothing further
        // when the 2 lines below are commented out, the exif data is shown, but the thumbnail is output as garbage
        header('Content-type: ' .image_type_to_mime_type($type));
        echo $imgdat;
    
        $exif = exif_read_data(MYFILE, 0, true);
        print "<table border=\"1\"><tr><td>Key</td><td>Name</td><td>Value</td></tr><tr>" ;
        foreach ($exif as $key => $section) {
            foreach ($section as $name => $val) {
            print "<td>" . $key . "</td>" ;
            print "<td>" . $name . "</td>" ;
            print "<td>" . $val . "</td>" ;
            print "</tr>" ;    
            }
        }
        print "</table>" ;
       
        // shows garbage, not the image
         echo $imgdat ;
    }
    ?>
    
  2. thanks Larry. Works like a charm.

    For anybody else who might needs this info, here is the section of my php.ini file

     

    ;;;;;;;;;;;;;;;;;;;;;;
    ; Dynamic Extensions ;
    ;;;;;;;;;;;;;;;;;;;;;;

    ; If you wish to have an extension loaded automatically, use the following
    ; syntax:
    ;
    ;   extension=modulename.extension
    ;
    ; For example, on Windows:
    ;
    ;   extension=msql.dll

    , make sure the 2 lines below are un-commented
    ;

    extension=php_mbstring.dll
    extension=php_exif.dll

  3. Hi,

    I should retrieve meta-data from image (jpg) files programatically in PHP and display them on a web-form. I googled a bit but what I found doesn't make much sense to me. It says something about compiling PHP which is puzzling. I never had to do that.

     

    I installed XAMPP in Windows XP that lets me use PHP and mySQL and everything goes smooth so far with the help of two of Larry's books. I never had to compile anything. However in the books there is no reference to EXIF. Does anybody have a link where to start? Or even a book, I wouldn't mind ordering it.

     

    thanks in advance

    Matt

     

×
×
  • Create New...