if there is a text file with the name of the current photo, get the caption from there,
else, get the caption from the iptc info in the photo
I've been looking through the code, and perhaps I have found what is wrong? Here is the code:
Code: Select all
function current_file_caption() {
global $media_dir, $current_file, $current_file_uri;
$temp_txt_URI = $media_dir.$current_file['category'].'/'.eregi_replace("[^[:alnum:]+]","_",strtolower(reset(explode('.',$current_file['file_name'])))).'.txt';
$size = getimagesize($current_file_uri, $info); // extract iptc info from file
if (glob($temp_txt_URI)) { // find if txt file w/ current media file name exists (PHP >= 4.3)
@include($temp_txt_URI); // include it in the page
} else if (isset($info["APP13"])) { // if not, check for IPTC info in the file
$iptc = iptcparse($info["APP13"]);
$desc_f_iptc = $iptc["2#120"][0]; // that's the IPTC array element corresponding to "caption/abstract" in IPTC block
echo("$desc_f_iptc"); // and echo it on the page
}
}
and it looks to me as if $temp_txt_URI gets set with the iptc data before the code ever checks to see if there is a .txt file present. Am I right, or do I need to keep looking for the problem?
I don't know a damn thing about code, so, be gentle.