I'm a brand new user here, and I'm working on creating a basic PHP photo gallery. The gallery portion seems to be working well at this point (displaying a thumbnail and link for each photo inside a directory), but the page to display an individual photo is giving me quite the headache. What I wanted to do was extract a few EXIF properties from each JPG file to write onto the page... I had no trouble doing so using exif_read_data() to get the date and certain camera settings, but when I attempt to print the UserComment field, I get a jarbled mess in Firefox (but not IE).
After some searching and testing (keep in mind I am completely new to PHP and web development in general so I may well be missing something here), I believe there is an issue with the character encoding of the string PHP is returning me. The EXIF UserComment field for each of my JPG files contains a comment string in Unicode, and evidently there is some issue when retrieving it through the following code:
><? $exif = exif_read_data($fileloc, 0, true);
$computedvals = $exif['COMPUTED'];
$caption = $computedvals['UserComment']; ?>
<html><body>
<? echo ($caption); ?>
</body><html>
Here is an example of the output I'm getting:
http://www.skyinmotion.com/viewphoto.php?g...me=CRW_5054.jpg
Note the last line of text before the "back" link at the bottom. For me, when using Firefox there is a jarbled mess of unreadable characters between the proper characters, and when using IE the spacing is incorrect -- either way, there is some type of character encoding issue. The actual contents of the UserComment field for this file are: "Lake Guntersville, Guntersville, AL"
My guess is that I need to correct this by converting the string PHP is returning in my $caption variable in the code above to Unicode, but from what character set I am not sure.
Any help would be appreciated!