Das müssten die Änderungen in der setartikelbild.php sein, weiter unten folgt Artikelpic.php
GILT nur für die MoPics Contri
Und hier die für die ArtikelPic.php
GILT nur für die MoPics Contri
Code:
<?php
/**
* jtlwawi_Connector/dbeS/setArtikelBild.php
* Synchronisationsscript
*
* Es gelten die Nutzungs- und Lizenzhinweise unter [url]http://www.jtl-software.de/jtlwawi.php[/url]
*
* @author JTL-Software <thomas@jtl-software.de>
* @copyright 2006, JTL-Software
* @link [url]http://jtl-software.de/jtlwawi.php[/url]
* @version v1.02 / 20.08.06
*/
require_once("syncinclude.php");
$return=3;
$_POST['userID'] = $_POST['euser'];
$_POST['userPWD'] = $_POST['epass'];
if (auth())
{
$return=0;
$products_id = getFremdArtikel(intval($_POST['kArtikelBild']));
$verzeich = getProdidKategorie($products_id);
$working_directory = DIR_FS_CATALOG_IMAGES . $verzeich;
if (!is_dir($working_directory)) {
mkdir($working_directory, 0777, 1);
chmod($working_directory, 0755); // Change to suit server needs, depending on directory owner
}
//nur BildNr 1 wird berücksichtigt
if (intval($_POST['kArtikelBild'])>0 && intval($_POST['nNr'])==1 && $_FILES['bild'])
{
//hol products_id
$products_id = getFremdArtikel(intval($_POST['kArtikelBild']));
if ($products_id>0)
{
$bildname=$verzeich."/".$products_id."_".(intval($_POST['nNr'])-1).".jpg";
move_uploaded_file($_FILES['bild']['tmp_name'],DIR_FS_CATALOG_IMAGES.$bildname);
chmod (DIR_FS_CATALOG_IMAGES.$bildname, 0644);
//updaten
eS_execute_query("update products set products_image=\"$bildname\" where products_id=".$products_id);
}
}
if (intval($_POST['kArtikelBild'])>0 && intval($_POST['nNr'])==2 && $_FILES['bild'])
{
//hol products_id
$products_id = getFremdArtikel(intval($_POST['kArtikelBild']));
if ($products_id>0)
{
$bildname=$verzeich."/".$products_id."_".(intval($_POST['nNr'])-1).".jpg";
move_uploaded_file($_FILES['bild']['tmp_name'],DIR_FS_CATALOG_IMAGES.$bildname);
chmod (DIR_FS_CATALOG_IMAGES.$bildname, 0644);
//updaten
eS_execute_query("update products set products_subimage1=\"$bildname\" where products_id=".$products_id);
}
}
if (intval($_POST['kArtikelBild'])>0 && intval($_POST['nNr'])==3 && $_FILES['bild'])
{
//hol products_id
$products_id = getFremdArtikel(intval($_POST['kArtikelBild']));
if ($products_id>0)
{
$bildname=$verzeich."/".$products_id."_".(intval($_POST['nNr'])-1).".jpg";
move_uploaded_file($_FILES['bild']['tmp_name'],DIR_FS_CATALOG_IMAGES.$bildname);
chmod (DIR_FS_CATALOG_IMAGES.$bildname, 0644);
//updaten
eS_execute_query("update products set products_subimage2=\"$bildname\" where products_id=".$products_id);
}
}
if (intval($_POST['kArtikelBild'])>0 && intval($_POST['nNr'])==4 && $_FILES['bild'])
{
//hol products_id
$products_id = getFremdArtikel(intval($_POST['kArtikelBild']));
if ($products_id>0)
{
$bildname=$verzeich."/".$products_id."_".(intval($_POST['nNr'])-1).".jpg";
move_uploaded_file($_FILES['bild']['tmp_name'],DIR_FS_CATALOG_IMAGES.$bildname);
chmod (DIR_FS_CATALOG_IMAGES.$bildname, 0644);
//updaten
eS_execute_query("update products set products_subimage3=\"$bildname\" where products_id=".$products_id);
}
}
if (intval($_POST['kArtikelBild'])>0 && intval($_POST['nNr'])==5 && $_FILES['bild'])
{
//hol products_id
$products_id = getFremdArtikel(intval($_POST['kArtikelBild']));
if ($products_id>0)
{
$bildname=$verzeich."/".$products_id."_".(intval($_POST['nNr'])-1).".jpg";
move_uploaded_file($_FILES['bild']['tmp_name'],DIR_FS_CATALOG_IMAGES.$bildname);
chmod (DIR_FS_CATALOG_IMAGES.$bildname, 0644);
//updaten
eS_execute_query("update products set products_subimage4=\"$bildname\" where products_id=".$products_id);
}
}
if (intval($_POST['kArtikelBild'])>0 && intval($_POST['nNr'])==6 && $_FILES['bild'])
{
//hol products_id
$products_id = getFremdArtikel(intval($_POST['kArtikelBild']));
if ($products_id>0)
{
$bildname=$verzeich."/".$products_id."_".(intval($_POST['nNr'])-1).".jpg";
move_uploaded_file($_FILES['bild']['tmp_name'],DIR_FS_CATALOG_IMAGES.$bildname);
chmod (DIR_FS_CATALOG_IMAGES.$bildname, 0644);
//updaten
eS_execute_query("update products set products_subimage5=\"$bildname\" where products_id=".$products_id);
}
}
if (intval($_POST['kArtikelBild'])>0 && intval($_POST['nNr'])==7 && $_FILES['bild'])
{
//hol products_id
$products_id = getFremdArtikel(intval($_POST['kArtikelBild']));
if ($products_id>0)
{
$bildname=$verzeich."/".$products_id."_".(intval($_POST['nNr'])-1).".jpg";
move_uploaded_file($_FILES['bild']['tmp_name'],DIR_FS_CATALOG_IMAGES.$bildname);
chmod (DIR_FS_CATALOG_IMAGES.$bildname, 0644);
//updaten
eS_execute_query("update products set products_subimage6=\"$bildname\" where products_id=".$products_id);
}
}
}
mysql_close();
echo($return);
logge($return);
?>
Und hier die für die ArtikelPic.php
Code:
<?php
/**
* jtlwawi_Connector/dbeS/ArtikelPict.php
* Synchronisationsscript
*
* Es gelten die Nutzungs- und Lizenzhinweise unter [url]http://www.jtl-software.de/jtlwawi.php[/url]
*
* @author JTL-Software <thomas@jtl-software.de>
* @copyright 2006, JTL-Software
* @link [url]http://jtl-software.de/jtlwawi.php[/url]
* @version v1.01 / 20.08.06
*/
require_once("syncinclude.php");
$picpath = "../catalog/images/";
$return=3;
if (auth())
{
$return=0;
/* $ArtikelPict = new ArtikelPict();
if (intval($_POST["action"]) == 1 && $ArtikelPict->setzePostDaten())
{
$oldArtikelPict = new ArtikelPict();
$oldArtikelPict->loadFromDB($ArtikelPict->kArtikel);
$GLOBALS["DB"]->executeQuery("DELETE from tartikelpict where kArtikel=".$ArtikelPict->kArtikel,4);
if ($ArtikelPict->insertInDB())
$return = 0;
else
$return = 1;
//gibt es alte Bilder zum löschen?
if ($oldArtikelPict->cPfad1 && !$ArtikelPict->cPfad1)
{
//bild nr 1 existiert nicht mehr. im fs löschen
if (file_exists($picpath.$oldArtikelPict->cPfad1))
{
unlink($picpath.$oldArtikelPict->cPfad1);
if (file_exists(substr($picpath.$oldArtikelPict->cPfad1, 0, -4).'-m.jpg'))
unlink(substr($picpath.$oldArtikelPict->cPfad1, 0, -4).'-m.jpg');
if (file_exists(substr($picpath.$oldArtikelPict->cPfad1, 0, -4).'-s.jpg'))
unlink(substr($picpath.$oldArtikelPict->cPfad1, 0, -4).'-s.jpg');
}
}
if ($oldArtikelPict->cPfad2 && !$ArtikelPict->cPfad2)
{
//bild nr 2 existiert nicht mehr. im fs löschen
if (file_exists($picpath.$oldArtikelPict->cPfad2))
{
unlink($picpath.$oldArtikelPict->cPfad2);
if (file_exists(substr($picpath.$oldArtikelPict->cPfad2, 0, -4).'-m.jpg'))
unlink(substr($picpath.$oldArtikelPict->cPfad2, 0, -4).'-m.jpg');
if (file_exists(substr($picpath.$oldArtikelPict->cPfad2, 0, -4).'-s.jpg'))
unlink(substr($picpath.$oldArtikelPict->cPfad2, 0, -4).'-s.jpg');
}
}
if ($oldArtikelPict->cPfad3 && !$ArtikelPict->cPfad3)
{
//bild nr 3 existiert nicht mehr. im fs löschen
if (file_exists($picpath.$oldArtikelPict->cPfad3))
{
unlink($picpath.$oldArtikelPict->cPfad3);
if (file_exists(substr($picpath.$oldArtikelPict->cPfad3, 0, -4).'-m.jpg'))
unlink(substr($picpath.$oldArtikelPict->cPfad3, 0, -4).'-m.jpg');
if (file_exists(substr($picpath.$oldArtikelPict->cPfad3, 0, -4).'-s.jpg'))
unlink(substr($picpath.$oldArtikelPict->cPfad3, 0, -4).'-s.jpg');
}
}
//bilder skalieren
if($ArtikelPict->cPfad1 && file_exists($picpath . $ArtikelPict->cPfad1))
{
$picbig = $picpath . $ArtikelPict->cPfad1;
$picmedium = substr($picpath . $ArtikelPict->cPfad1, 0, -4).'-m.jpg';
$picsmall = substr($picpath . $ArtikelPict->cPfad1, 0, -4).'-s.jpg';
$image = imagecreatefromjpeg($picbig);
list($width, $height) = getimagesize($picbig);
$ratio = $width / $height;
//thumbnail
$new_width = 80;
$new_height = round (80 / $ratio);
$image_p = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_p, $picsmall, 80);
//medium
$new_width = 210;
$new_height = round (210 / $ratio);
$image_p = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_p, $picmedium, 80);
//groß
$new_width = 800;
$new_height = round (800 / $ratio);
if ($width>$new_width || $height>$new_height)
{
$image_p = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_p, $picbig, 100);
}
}
if( $ArtikelPict->cPfad2 && file_exists($picpath . $ArtikelPict->cPfad2))
{
$picbig = $picpath . $ArtikelPict->cPfad2;
$picmedium = substr($picpath . $ArtikelPict->cPfad2, 0, -4).'-m.jpg';
$picsmall = substr($picpath . $ArtikelPict->cPfad2, 0, -4).'-s.jpg';
$image = imagecreatefromjpeg($picbig);
list($width, $height) = getimagesize($picbig);
$ratio = $width / $height;
//thumbnail
$new_width = 80;
$new_height = round (80 / $ratio);
$image_p = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_p, $picsmall, 100);
//medium
$new_width = 210;
$new_height = round (210 / $ratio);
$image_p = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_p, $picmedium, 100);
//medium
$new_width = 800;
$new_height = round (800 / $ratio);
if ($width>$new_width || $height>$new_height)
{
$image_p = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_p, $picbig, 100);
}
}
if( $ArtikelPict->cPfad3 && file_exists($picpath . $ArtikelPict->cPfad3))
{
$picbig = $picpath . $ArtikelPict->cPfad3;
$picmedium = substr($picpath . $ArtikelPict->cPfad3, 0, -4).'-m.jpg';
$picsmall = substr($picpath . $ArtikelPict->cPfad3, 0, -4).'-s.jpg';
$image = imagecreatefromjpeg($picbig);
list($width, $height) = getimagesize($picbig);
$ratio = $width / $height;
//thumbnail
$new_width = 80;
$new_height = round (80 / $ratio);
$image_p = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_p, $picsmall, 100);
//medium
$new_width = 210;
$new_height = round (210 / $ratio);
$image_p = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_p, $picmedium, 100);
//medium
$new_width = 800;
$new_height = round (800 / $ratio);
if ($width>$new_width || $height>$new_height)
{
$image_p = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_p, $picbig, 100);
}
}
}
else
$return=5;
*/
if (intval($_POST["action"]) == 3 && intval($_POST['KeyArtikel'])>0)
{
$return =0;
//hol products_id
$products_id = getFremdArtikel(intval($_POST['KeyArtikel']));
if ($products_id>0)
{
eS_execute_query("update products set products_image='' where products_id=".$products_id);
}
if ($products_id>0)
{
eS_execute_query("update products set products_subimage1='' where products_id=".$products_id);
}
if ($products_id>0)
{
eS_execute_query("update products set products_subimage2='' where products_id=".$products_id);
}
if ($products_id>0)
{
eS_execute_query("update products set products_subimage3='' where products_id=".$products_id);
}
if ($products_id>0)
{
eS_execute_query("update products set products_subimage4='' where products_id=".$products_id);
}
if ($products_id>0)
{
eS_execute_query("update products set products_subimage5='' where products_id=".$products_id);
}
if ($products_id>0)
{
eS_execute_query("update products set products_subimage6='' where products_id=".$products_id);
}
}
}
mysql_close();
echo($return);
//logge($return);
?>