/**
 * eazySales_Connector/dbeS/setArtikelBild.php
 * Synchronisationsscript
 * 
 * Es gelten die Nutzungs- und Lizenzhinweise unter http://www.jtl-software.de/eazysales.php
 * 
 * @author JTL-Software <*****@*****.**>
 * @copyright 2006, JTL-Software
 * @link http://jtl-software.de/eazysales.php
 * @version v1.0 / 20.06.06
*/
define('OOS_VALID_MOD', 'yes');
require 'syncinclude.php';
$_POST['userID'] = $_POST['euser'];
$_POST['userPWD'] = $_POST['epass'];
$return = 3;
if (auth()) {
    $return = 0;
    //nur BildNr 1 wird bercksichtigt
    if (intval($_POST['kArtikelBild']) > 0 && intval($_POST['nNr']) == 1 && $_FILES['bild']) {
        //hol categories_id
        $categories_id = getFremdKategorie(intval($_POST['kArtikelBild']));
        $bildname = $categories_id . ".jpg";
        move_uploaded_file($_FILES['bild']['tmp_name'], DIR_FS_CATALOG_IMAGES . "categories/" . $bildname);
        //updaten
        $categoriestable = $oostable['categories'];
        xtc_db_query("UPDATE {$categoriestable} SET categories_image=\"{$bildname}\" WHERE categories_id=" . $categories_id);
    }
}
echo $return;
logge($return);
    			$image = imagecreatefromjpeg($picbig);
    			list($width, $height) = getimagesize($picbig);
    			
    		//thumbnail
    			$ratio = $width / $height;
    			$new_width = 100;
    			$new_height = round (100 / $ratio);
    			
    			if ($new_height>100)
    			{
    				$new_height=100;
    				$new_width=100*$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);
    		}
     	}
    	else
    		$return=5;
    */
    if (intval($_POST['action']) == 3 && intval($_POST['KeyKategorie']) > 0) {
        $return = 0;
        //hol categories_id
        $categories_id = getFremdKategorie(intval($_POST['KeyKategorie']));
        $categoriestable = $oostable['categories'];
        xtc_db_query("UPDATE {$categoriestable} SET categories_image='' WHERE categories_id=" . $categories_id);
    }
}
echo $return;
logge($return);