} $im_crop->setSave_scale(1); $im_crop->setSave_name($_SESSION["path"] . $_SESSION["uploaded_file"]); if (!$im_crop->doResize()) { print_r($im_crop->getErrorMessage()); exit; } switch ($_SESSION["module"]) { case "category": $cat = new Category($_SESSION["id"]); $cat->setImage($_SESSION["uploaded_file"]); $cat->save(); break; case "vendor": $vend = new Vendor($_SESSION["id"]); $vend->setLogo($_SESSION["uploaded_file"]); $vend->save(); break; default: break; } $module = $_SESSION["module"]; unset($_SESSION["uploaded_file"]); unset($_SESSION["id"]); unset($_SESSION["module"]); unset($_SESSION["path"]); unset($_SESSION["url"]); header("Location: " . $module . ".php?do=list"); exit; } else { $ft->define(array("main" => "template_index.html", "content" => "error.html"));