I have been looking for this problem for 3 days now - and trying anything close or related to see if i can get it working....
I am pulling EXIF tags from JPG files with PHP
and using it in a simple mouseover script, but that is where it breaks down:
Getting the EXIF Data
foreach($images as $img){
$exif = exif_read_data($img, 0, true);
And during my testing I put simplified the variable names - I don't think this is necessary but this is where I am now
$Ititle = $exif['IFD0']['Title'];
$Isubject = $exif['IFD0']['Subject'];
$Icomment = $exif['IFD0']['Comments'];
$m = "<p>Title: ".$Ititle."<BR>Subject: ".$Isubject."<BR>Comments: ".$Icomment."</p>";
echo $m;
This Echo $m works the Title / Subject / Comments from the Jpg image look as expected.
So I have a thumbnail image using with a mouseover to change the big image "preview1.2.3.4..." to the img you mouseover.... and Change a <p>
to the correct title / subject / comments..
<img onmouseover="document.getElementById('exifdata<?echo $b;?>').innerHTML = '<?echo $m;?>'; preview<?echo $b;?>.src=img<?echo $p;?>.src" name="img<?echo $p;?>" src="<?echo $img;?>" style="float:left; margin-right:10px; Max-width: 100px; Max-height:100px; width:auto; height:auto;">
The Img and text change works on rollover but
in the <p>
it shows up like this
Title: H�a�p�p�y� �C�o�u�p�l�e���
Subject: E�n�j�o�y�i�n�g� �I�N� �S�u�m�m�e�r�s���
Comments:
Here is the DIV where the text changes
<div style="width:680px; height:auto; overflow:hidden; background: rgba(66, 95, 149, 1);">
<p id='exifdata<?echo $b;?>'>testing
</p>
</div>
What is adding these question marks After it gets passed through this innerHTML?
And the entire php page: *sorry if it is messy - I have been trying a lot of things
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<?php
header('Content-Type:text/html; charset=UTF-8');
$b = 1;
$blogs = array_filter(glob('./Content/*'), 'is_dir');
foreach($blogs as $entries){
/*
print "<br>";
print $entries;
print "<br>";
print "<p>Images</p>";
*/
#get all the JPG s in the blog folder
$images = array_filter(glob("$entries/*.JPG"));
#get Textblock and title txt files for verbage....
$textblock = file_get_contents("$entries/Textblock.txt");
$title = file_get_contents("$entries/Title.txt");
#get date for post
$PostDatestr = substr($entries,-8);
$PostDate = date("d M Y", strtotime($PostDatestr));
#Create Entry regardless of type:
?>
<div id="Notice">
<div id="Title"><h2><?echo $title;?></h2></div>
<section class="Wrapper">
<header class="Wrapper"><h1><?echo $PostDate;?></h1></header>
<article>
<?
#print the Blog post.... if one or less photos in DIR
if (count($images) <= 1){
#Don't use img tag if there are 0 images.
if (count($images) === 1){
?><img src="<?echo $images[0];?>" style="float:left; margin-right:10px; Max-width: 680px; Max-height:680px; width:auto; height:auto;">
<?
}
echo $textblock;
}
#print the Blog post.... if there is more than 1 photo in DIR
if (count($images) > 1){
#get info for each photo
?>
<div class="thumbnails" style="width;100%; height:auto; display:block; overflow:hidden;">
<?
foreach($images as $img){
$exif = exif_read_data($img, 0, true);
$Ititle = $exif['IFD0']['Title'];
$Isubject = $exif['IFD0']['Subject'];
$Icomment = $exif['IFD0']['Comments'];
$m = "<p>Title: ".$Ititle."<BR>Subject: ".$Isubject."<BR>Comments: ".$Icomment."</p>";
echo $m;
#echo $exif===false ? "No header data found.<br />\n" : "Image contains headers<br />\n";
?>
<img onmouseover="document.getElementById('exifdata<?echo $b;?>').innerHTML = '<?echo $m;?>'; preview<?echo $b;?>.src=img<?echo $p;?>.src" name="img<?echo $p;?>" src="<?echo $img;?>" style="float:left; margin-right:10px; Max-width: 100px; Max-height:100px; width:auto; height:auto;">
<?
$p++;
$lastimg = $img;
}
?>
</div>
<br><br>
<div class="preview<?echo $b;?>" align="center" Style="width:640px; margin:0 auto; overflow:hidden;">
<img name="preview<?echo $b;?>" src="<?echo $lastimg;?>" style="float:left; margin-right:10px; Max-width: 680px; Max-height:680px; width:auto; height:auto;" alt=""/>
</div>
<div style="width:680px; height:auto; overflow:hidden; background: rgba(66, 95, 149, 1);">
<p id='exifdata<?echo $b;?>'>testing
</p>
</div>
<?
}
?>
</article>
</Section>
</div>
<?
$b++;
}
?>
</body>
</html>
Title: ".$Ititle."
";` – traktor Sep 30 '15 at 23:20Subject: ".$Isubject."
Comments: ".$Icomment."