Matt.F. Posted July 21, 2014 Share Posted July 21, 2014 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 Link to comment Share on other sites More sharing options...
Larry Posted July 22, 2014 Share Posted July 22, 2014 If you're using Windows, you probably won't ever compile PHP. You just enable different DLLs and restart the web server: http://us3.php.net/manual/en/exif.installation.php Link to comment Share on other sites More sharing options...
Matt.F. Posted July 22, 2014 Author Share Posted July 22, 2014 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.dllextension=php_exif.dll Link to comment Share on other sites More sharing options...
Larry Posted July 23, 2014 Share Posted July 23, 2014 Glad to hear you got it and thanks for sharing! Link to comment Share on other sites More sharing options...
Matt.F. Posted September 6, 2014 Author Share Posted September 6, 2014 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 ; } ?> Link to comment Share on other sites More sharing options...
Larry Posted September 8, 2014 Share Posted September 8, 2014 You can't have a script output both binary data (e.g., an image) and plain text (e.g., HTML). To do this, you'll want to generate HTML that includes an IMG tag that shows the image. Link to comment Share on other sites More sharing options...
HartleySan Posted September 8, 2014 Share Posted September 8, 2014 Yes, you basically need to use a proxy script to display your image. Here's a good link that explains it simply: http://foundationphp.com/tutorials/image_proxy.php Link to comment Share on other sites More sharing options...
Matt.F. Posted September 10, 2014 Author Share Posted September 10, 2014 thanks guys. I'll take a look. Matt Link to comment Share on other sites More sharing options...
Matt.F. Posted November 20, 2014 Author Share Posted November 20, 2014 Me again.... just a general question, I don't know where to start. I need to display an image in full-screen size, plus add some simple slide-show features (next image, previous image, popup Exif-data when a link or button is pressed, and similar). Just a link or a reference to one of Larry's great books would help me get started. thanks a lot Matt Link to comment Share on other sites More sharing options...
HartleySan Posted November 20, 2014 Share Posted November 20, 2014 Full-screening the image is done with simple CSS, and creating a slideshow is mostly JS. While that topic specifically is not covered in Larry's JS book, you could still probably learn enough in the book to do it yourself. You could also do some Googling for "JS slideshow", and probably get it done from there. 1 Link to comment Share on other sites More sharing options...
Recommended Posts