Hi!
Dieser MOD erweitert die in der Version 1.7.6 enthaltene IPTC funktion um folgendes:
alle IPTC Daten der Bilder in der Galerie, werden ausgelesen und in die Datenbank geschrieben.
Die Suchfelder der Galerie werden um die IPTC felder erweitert,
dadurch kann die Datenbank nach IPTC einträgen durchsucht werden.
Bevor ihr diese Modifikation durchführt DATENBANK SICHERN!! Zu Modifizierenden Dateien: 1.)SQL Table Word_Match
2.)SQL Table 4images_images
(im Anhang befindet sich die install_iptc.php um die benötigten Datenbankfelder automatisch anzulegen, Besten Dank an Nicky!)
3.)includes/db_field_definitions.php
4.)includes/search_utils.php
5.)lang/deutsch/main.php
6.)templates/dein_templates/search_form.html
7.)includes/functions.php
die dazu benötigten Dateien befinden sich im Anhang.
1.) Die Datenbank 4images_wordmatch um folgende Felder erweitern: ALTER TABLE 4images_wordmatch
ADD `caption_match` TINYINT(1) DEFAULT '0' NOT NULL,
ADD `caption_writer_match` TINYINT(1) DEFAULT '0' NOT NULL,
ADD `headline_match` TINYINT(1) DEFAULT '0' NOT NULL,
ADD `special_instructions_match` TINYINT(1) DEFAULT '0' NOT NULL,
ADD `byline_match` TINYINT(1) DEFAULT '0' NOT NULL,
ADD `byline_title_match` TINYINT(1) DEFAULT '0' NOT NULL,
ADD `credit_match` TINYINT(1) DEFAULT '0' NOT NULL,
ADD `source_match` TINYINT(1) DEFAULT '0' NOT NULL,
ADD `object_name_match` TINYINT(1) DEFAULT '0' NOT NULL,
ADD `date_created_match`TINYINT(1) DEFAULT '0' NOT NULL,
ADD `city_match` TINYINT(1) DEFAULT '0' NOT NULL,
ADD `state_match` TINYINT(1) DEFAULT '0' NOT NULL,
ADD `country_match` TINYINT(1) DEFAULT '0' NOT NULL,
ADD `original_transmission_reference_match` TINYINT(1) DEFAULT '0' NOT NULL,
ADD `category_match` TINYINT(1) DEFAULT '0' NOT NULL,
ADD `supplemental_category_match` TINYINT(1) DEFAULT '0' NOT NULL,
ADD `keyword_match` TINYINT(1) DEFAULT '0' NOT NULL,
ADD `copyright_notice_match` TINYINT(1) DEFAULT '0' NOT NULL;
2.) Die Datenbank 4images_images um folgende Felder erweitern: ALTER TABLE `4images_images`
ADD `image_caption` VARCHAR( 255 ) NOT NULL ,
ADD `image_caption_writer` VARCHAR( 200 ) NOT NULL ,
ADD `image_headline` VARCHAR( 255 ) NOT NULL ,
ADD `image_special_instructions` VARCHAR( 255 ) NOT NULL ,
ADD `image_byline` VARCHAR( 32 ) NOT NULL ,
ADD `image_byline_title` VARCHAR( 32 ) NOT NULL ,
ADD `image_credit` VARCHAR( 32 ) NOT NULL ,
ADD `image_source` VARCHAR( 32 ) NOT NULL ,
ADD `image_object_name` VARCHAR( 64 ) NOT NULL ,
ADD `image_date_created` VARCHAR( 10 ) NOT NULL ,
ADD `image_city` VARCHAR( 32 ) NOT NULL ,
ADD `image_state` VARCHAR( 32 ) NOT NULL ,
ADD `image_country` VARCHAR( 64 ) NOT NULL ,
ADD `image_original_transmission_reference` VARCHAR( 255 ) NOT NULL ,
ADD `image_category` VARCHAR( 255 ) NOT NULL ,
ADD `image_supplemental_category` VARCHAR( 255 ) NOT NULL ,
ADD `image_keyword` VARCHAR( 255 ) NOT NULL ,
ADD `image_copyright_notice` VARCHAR( 128 ) NOT NULL ;
3.)in der includes/db_field_definitions.php vor ?>
//>>>>>>>>>>>>>>>>>>>>>>>>>>Iptc start<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$additional_image_fields['image_caption'] = array($lang['iptc_caption'], "text", 0);
$additional_image_fields['image_caption_writer'] = array($lang['iptc_caption_writer'], "text", 0);
$additional_image_fields['image_headline'] = array($lang['iptc_headline'], "text", 0);
$additional_image_fields['image_special_instructions'] = array($lang['iptc_special_instructions'], "text", 0);
$additional_image_fields['image_byline'] = array($lang['iptc_byline'], "text", 0);
$additional_image_fields['image_byline_title'] = array($lang['iptc_byline_title'], "text", 0);
$additional_image_fields['image_credit'] = array($lang['iptc_credit'], "text", 0);
$additional_image_fields['image_source'] = array($lang['iptc_source'], "text", 0);
$additional_image_fields['image_object_name'] = array($lang['iptc_object_name'], "text", 0);
$additional_image_fields['image_date_created'] = array($lang['iptc_date_created'], "text", 0);
$additional_image_fields['image_city'] = array($lang['iptc_city'], "text", 0);
$additional_image_fields['image_state'] = array($lang['iptc_state'], "text", 0);
$additional_image_fields['image_country'] = array($lang['iptc_country'], "text", 0);
$additional_image_fields['image_original_transmission_reference'] = array($lang['iptc_original_transmission_reference'], "text", 0);
$additional_image_fields['image_category'] = array($lang['iptc_category'], "text", 0);
$additional_image_fields['image_supplemental_category'] = array($lang['iptc_supplemental_category'], "text", 0);
$additional_image_fields['image_keyword'] = array($lang['iptc_keyword'], "text", 0);
$additional_image_fields['image_copyright_notice'] = array($lang['iptc_copyright_notice'], "text", 0);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<iptc-end<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
4.)suche in der includes/search_utils.php nach:
$search_match_fields = array(
"image_name" => "name_match",
"image_description" => "desc_match",
"image_keywords" => "keys_match"
);
ersetze es mit:
$search_match_fields = array(
"image_name" => "name_match",
"image_description" => "desc_match",
"image_keywords" => "keys_match",
"image_caption" =>"caption_match",
"image_caption_writer" =>"caption_writer_match",
"image_headline" =>"headline_match",
"image_special_instructions" =>"special_instructions_match",
"image_byline" =>"byline_match",
"image_byline_title" =>"byline_title_match",
"image_credit" =>"credit_match",
"image_source" =>"source_match",
"image_object_name" =>"object_name_match",
"image_date_created" =>"date_created_match",
"image_city" =>"city_match",
"image_state" =>"state_match",
"image_country" =>"country_match",
"image_original_transmission_reference" =>"original_transmission_reference_match",
"image_category" =>"category_match",
"image_supplemental_category" =>"supplemental_category_match",
"image_keyword" =>"keyword_match",
"image_copyright_notice" =>"copyright_notice_match"
);
5.)sucht in der lang/deutsch/main.php $lang['or'] = "ODER";
und fügt danach ein:
$lang['image_caption_only'] = "Objektbeschreibung:";
$lang['image_caption_writer_only'] = "Autor:";
$lang['image_headline_only'] = "Überschrift:";
$lang['image_special_instructions_only'] = "Besondere Hinweise:";
$lang['image_byline_only'] = "Name des Autors:";
$lang['image_byline_title_only'] = "Titel des Autors:";
$lang['image_credit_only'] = "Bildrechte:";
$lang['image_source_only'] = "Quelle:";
$lang['image_object_name_only'] = "Objekt Name:";
$lang['image_date_created_only'] = "Erstellt am:";
$lang['image_city_only'] = "Stadt/Ort:";
$lang['image_state_only'] = "Bundesland:";
$lang['image_country_only'] = "Ländername:";
$lang['image_original_transmission_reference_only'] = "Auftraggeber:";
$lang['image_category_only'] = "Kategorien:";
$lang['image_supplemental_category_only'] = "zusätzliche Kategorie:";
$lang['image_keyword_only'] = "Stichworte:";
$lang['image_copyright_notice_only'] = "Copyright-Vermerk:";
6.)sucht in der templates/dein_templates/search_form.html <td nowrap="nowrap"><input type="radio" name="search_fields" value="all" checked="checked" /> {lang_all_fields}</td>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"><input type="radio" name="search_fields" value="image_name" /> {lang_name_only}</td>
</tr>
<tr>
<td nowrap="nowrap"><input type="radio" name="search_fields" value="image_description" /> {lang_description_only}</td>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"><input type="radio" name="search_fields" value="image_keywords" /> {lang_keywords_only}</td>
und ersetzt es mit:
(Ihr könnt den Code natürlich auch an jeder anderen Stelle in eurer Datei hinein kopieren.
Als Beispiel habe ich die default templates/ search_form.html genommen)
<select name="search_fields" size="1">
<optgroup label="Allgemein">
<option value="all">{lang_all_fields}</option>
<option value="image_name">{lang_name_only}</option>
<option value="image_description">{lang_description_only}</option>
<option value="image_keywords">{lang_keywords_only}</option>
</optgroup>
<optgroup label="IPTC">
<option value="image_caption">{lang_image_caption_only}</option>
<option value="image_caption_writer">{lang_image_caption_writer_only}</option>
<option value="image_headline">{lang_image_headline_only}</option>
<option value="image_special_instructions">{lang_image_special_instructions_only}</option>
<option value="image_byline">{lang_image_byline_only}</option>
<option value="image_byline_title">{lang_image_byline_title_only}</option>
<option value="image_credit">{lang_image_credit_only}</option>
<option value="image_source">{lang_image_source_only}</option>
<option value="image_object_name">{lang_image_object_name_only}</option>
<option value="image_date_created">{lang_image_date_created_only}</option>
<option value="image_city">{lang_image_city_only}</option>
<option value="image_state">{lang_image_state_only}</option>
<option value="image_country">{lang_image_country_only}</option>
<option value="image_original_transmission_reference">{lang_image_original_transmission_reference_only}</option>
<option value="image_category">{lang_image_category_only}</option>
<option value="image_supplemental_category">{lang_image_supplemental_category_only}</option>
<option value="image_keyword">{lang_image_keyword_only}</option>
<option value="image_copyright_notice">{lang_image_copyright_notice_only}</option>
</optgroup>
</select>
7.) suche in der functions.php:
if ($detailed_view && isset($info['APP13'])) {
$iptc_array = get_iptc_info($info['APP13']);
$bgcounter = 0;
foreach ($iptc_array as $key => $val) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$site_template->register_vars(array(
"iptc_value" => format_text($val),
"iptc_name" => $lang['iptc_'.$key],
"row_bg_number" => $row_bg_number
));
$iptc_info .= $site_template->parse_template("iptc_bit");
}
}
und ersetze es mit:
if ($detailed_view && isset($info['APP13'])) {
//################################# Start IPTC aus DB #################################################################
global $site_db,$lang;
$sql = "SELECT image_caption, image_caption_writer, image_headline, image_special_instructions, image_byline, image_byline_title, image_credit,
image_source,image_object_name, image_date_created, image_city, image_state, image_country, image_original_transmission_reference, image_category,
image_supplemental_category, image_keyword, image_copyright_notice
FROM ".IMAGES_TABLE."
WHERE image_id = '$image_id'";
$result = $site_db->query($sql);
$row = mysql_fetch_object($result);
//################################# End IPTC aus DB #################################################################
// $iptc_array = get_iptc_info($info['APP13']);
// Original
$bgcounter = 0;
foreach ($row as $key => $val) {
// IPTC aus DB
if ($key == "image_date_created") {
$val = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\3.\\2.\\1", $row->image_date_created);
}
if ($val != "") {
// IPTC aus DB
$key = str_replace('image_','',($key));
// IPTC aus DB
// foreach ($iptc_array as $key => $val) {
// Original
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$site_template->register_vars(array(
"iptc_value" => format_text($val), // Original
"iptc_name" => $lang['iptc_'.$key],
"row_bg_number" => $row_bg_number
));
$iptc_info .= $site_template->parse_template("iptc_bit");
}
}
} // IPTC aus DB
Im Anhang befinden sich zwei checkimages.php,
eine für diejenigen die die beiden Mods haben "EXIF 1.7.6 inkl. Suchfelder" ,
und eine nur für diesen [MOD] die, die IPTC Daten ausliest.
Ersetzt bitte eure admin/checkimages.php mit eine der beiden versionen hier im anhang die ihr benötigt.
Kopiert die datei update_IPTC_index.php (im Anhang) nach admin/plugin
mit dieser Datei werden die vorhanden Bilder der Galerie nach IPTC Daten durchsucht und in die Datenbank geschrieben.
Zuletzt führt bitte die Datei rebuild_searchindex.php (im Anhang) aus.
so ich hoffe das ich nichts vergessen habe, falls doch gebt bescheid.
mfg Andi