} // Initialize Session data ob_start(); include_once "phprptinc/ewrcfg8.php"; include_once "phprptinc/ewmysql.php"; include_once "phprptinc/ewrfn8.php"; // Get resize parameters $resize = @$_GET["resize"] != ""; $width = @$_GET["width"] != "" ? $_GET["width"] : 0; $height = @$_GET["height"] != "" ? $_GET["height"] : 0; if (@$_GET["width"] == "" && @$_GET["height"] == "") { $width = EWR_THUMBNAIL_DEFAULT_WIDTH; $height = EWR_THUMBNAIL_DEFAULT_HEIGHT; } $quality = @$_GET["quality"] != "" ? $_GET["quality"] : EWR_THUMBNAIL_DEFAULT_QUALITY; // Resize image from physical file if (@$_GET["fn"] != "") { $fn = ewr_StripSlashes($_GET["fn"]); $fn = str_replace("", "", $fn); $fn = ewr_PathCombine(ewr_AppRoot(), $fn, TRUE); if (file_exists($fn)) { $pathinfo = pathinfo($fn); $ext = strtolower($pathinfo['extension']); $size = getimagesize($fn); if ($size) { header("Content-type: {$size['mime']}"); } echo ewr_ResizeFileToBinary($fn, $width, $height, $quality); } exit; }
function ewr_DeleteTmpImages($html = "") { global $gTmpImages; foreach ($gTmpImages as $tmpimage) { @unlink(ewr_AppRoot() . EWR_UPLOAD_DEST_PATH . $tmpimage); } // Check and remove temp images from html content (start with session id) if (preg_match_all('/<img([^>]*)>/i', $html, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { if (preg_match('/\\s+src\\s*=\\s*[\'"]([\\s\\S]*?)[\'"]/i', $match[1], $submatches)) { // Match src='src' $src = $submatches[1]; $exportid = session_id(); $src = basename($src); if (substr($src, 0, strlen($exportid)) == $exportid || substr($src, 0, 3) == "tmp") { // Temp image @unlink(ewr_AppRoot() . EWR_UPLOAD_DEST_PATH . $src); } } } } }