Hallo Jan,
ich habe versucht, gemäß dieses Threads Daten aus Extensis Portfolio nach 4images zu importieren. Leider ohne Erfolg.
Zuerst habe ich eine Kat (ID 40) angelegt, danach per FTP Bilder hochgeladen und dann mit Check neue Bilder importiert. Soweit alles o.k.
Mit Extensis Portfolio habe ich dann eine TXT-Datei in diesem Format erstellt:
crw_1828.jpg Fort Sagres AlgarveCarvoeiraPortugal
crw_1799.jpg Fort Sagres AlgarveCarvoeiraPortugal
crw_1800.jpg Fort Sagres AlgarveCarvoeiraPortugal
crw_1801.jpg Fort Sagres AlgarveCarvoeiraPortugal
crw_1806.jpg Fort Sagres AlgarveCarvoeiraPortugal
crw_1810.jpg Fort Sagres AlgarveCarvoeiraPortugal
crw_1814.jpg Fort Sagres AlgarveCarvoeiraPortugal
crw_1817.jpg Fort Sagres AlgarveCarvoeiraPortugal
crw_1818.jpg Fort Sagres AlgarveCarvoeiraPortugal
crw_1819.jpg Fort Sagres AlgarveCarvoeiraPortugal
crw_1821.jpg Fort Sagres AlgarveCarvoeiraPortugal
... usw
Beim Import erhalte ich dann für alle zu importierenden Bilder SQL-Fehlermeldungen wie folgt:
Update ID crw_1828.jpg Fort Sagres AlgarveCarvoeiraPortugal....
DB Error: Bad SQL Query: UPDATE 4images_images SET image_name = '', image_description = '', image_keywords = '' WHERE image_id = crw_1828.jpg Fort Sagres AlgarveCarvoeiraPortugal
You have an error in your SQL syntax near 'Fort Sagres AlgarveCarvoeiraPortugal' at line 3
DB Error: Bad SQL Query: SELECT image_id, image_name, image_description, image_keywords FROM 4images_images WHERE image_id = crw_1828.jpg Fort Sagres AlgarveCarvoeiraPortugal
You have an error in your SQL syntax near 'Fort Sagres AlgarveCarvoeiraPortugal' at line 3
Image not found.
Update ID crw_1799.jpg Fort Sagres AlgarveCarvoeiraPortugal....
DB Error: Bad SQL Query: UPDATE 4images_images SET image_name = '', image_description = '', image_keywords = '' WHERE image_id = crw_1799.jpg Fort Sagres AlgarveCarvoeiraPortugal
You have an error in your SQL syntax near 'Fort Sagres AlgarveCarvoeiraPortugal' at line 3
DB Error: Bad SQL Query: SELECT image_id, image_name, image_description, image_keywords FROM 4images_images WHERE image_id = crw_1799.jpg Fort Sagres AlgarveCarvoeiraPortugal
You have an error in your SQL syntax near 'Fort Sagres AlgarveCarvoeiraPortugal' at line 3
Image not found.
Update ID crw_1800.jpg Fort Sagres AlgarveCarvoeiraPortugal....
DB Error: Bad SQL Query: UPDATE 4images_images SET image_name = '', image_description = '', image_keywords = '' WHERE image_id = crw_1800.jpg Fort Sagres AlgarveCarvoeiraPortugal
You have an error in your SQL syntax near 'Fort Sagres AlgarveCarvoeiraPortugal' at line 3
.... usw
0 Einträge importiert
Ich habe dieses Script verwendet:
<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: backup.php *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.0 *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (Lizenz.txt) für weitere Informationen. *
* --------------------------------------------------------------- *
* This script is NOT freeware! Please read the Copyright Notice *
* (Licence.txt) for further information. *
* *
*************************************************************************/
$nozip = 1;
define('IN_CP', 1);
define('ROOT_PATH', './../');
require('admin_global.php');
include(ROOT_PATH.'includes/search_utils.php');
if ($action == "") {
$action = "importintro";
}
show_admin_header();
if ($action == "startimport") {
if ($HTTP_POST_FILES['file']['tmp_name'] != "none") {
$cont = file($HTTP_POST_FILES['file']['tmp_name']);
if(!empty($cont)) {
$data = array();
$count = 0;
while(list($key, $val) = each($cont)) {
$line = explode("|", $val);
$line[0] = trim($line[0]);
$search_index_match = "";
if (preg_match("/\.[a-z]{2,4}$/", $line[0])) {
echo "Update ".$line[0]."....";
flush();
@set_time_limit(90);
$site_db->query("UPDATE ".IMAGES_TABLE."
SET image_name = '".addslashes(trim($line[1]))."', image_description = '".addslashes(trim($line[2]))."', image_keywords = '".addslashes(trim($line[3]))."'
WHERE image_media_file = '".$line[0]."'");
$search_index_match = "image_media_file = '".$line[0]."'";
}
else {
echo "Update ID ".$line[0]."....";
flush();
@set_time_limit(90);
$site_db->query("UPDATE ".IMAGES_TABLE."
SET image_name = '".addslashes(trim($line[1]))."', image_description = '".addslashes(trim($line[2]))."', image_keywords = '".addslashes(trim($line[3]))."'
WHERE image_id = ".$line[0]);
$search_index_match = "image_id = ".$line[0];
}
if (!empty($search_index_match)) {
$row = $site_db->query_firstrow("SELECT image_id, image_name, image_description, image_keywords
FROM ".IMAGES_TABLE."
WHERE $search_index_match");
if ($row) {
remove_searchwords($row['image_id']);
$search_words = array();
foreach ($search_match_fields as $image_column => $match_column) {
if (isset($HTTP_POST_VARS[$image_column])) {
$search_words[$image_column] = stripslashes($row[$image_column]);
}
}
add_searchwords($row['image_id'], $search_words);
echo "<b>".$lang['resizing_image_success']."</b><br>";
$count++;
}
else {
echo "<b>Image not found.</b><br>";
}
}
}
}
echo "<p><b>".$count."</b> Einträge importiert";
}
else {
$action = "importintro";
}
}
if ($action == "importintro") {
?>
<form method="post" action="<?php echo $self_url ?>" enctype="multipart/form-data">
Importfile:<br />
<input type="file" name="file"><br /><br />
<input type="submit" name="Abschicken" value="Start Import" class="button">
<input type="hidden" name="action" value="startimport">
</form>
<?php
}
show_admin_footer();
?>
Ich habe leider (noch) keinen Dunst von PHP und weiss nicht, warum es nicht funktioniert. Ich vermute mal, es liegt an der image_id, weil die nicht aus Extensis Portfolio an die TXT-Datei übergeben wird.
Jan, wenn Du das liest, gib mir bitte mal einen Tipp.
Beste Gruesse