Example #1
0
}
// 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;
}
Example #2
0
 function GetTempImage()
 {
     if ($this->FldDataType == EWR_DATATYPE_BLOB) {
         $wrkdata = $this->DbValue;
         if (!empty($wrkdata)) {
             if ($this->ImageResize) {
                 $wrkwidth = $this->ImageWidth;
                 $wrkheight = $this->ImageHeight;
                 ewr_ResizeBinary($wrkdata, $wrkwidth, $wrkheight, $this->ResizeQuality);
             }
             return ewr_TmpImage($wrkdata);
         }
     } else {
         $wrkfile = $this->DbValue;
         if (empty($wrkfile)) {
             $wrkfile = $this->CurrentValue;
         }
         if (!empty($wrkfile)) {
             $tmpfiles = explode(EWR_MULTIPLE_UPLOAD_SEPARATOR, $wrkfile);
             $tmpimage = "";
             foreach ($tmpfiles as $tmpfile) {
                 if ($tmpfile != "") {
                     $imagefn = ewr_UploadPathEx(TRUE, $this->UploadPath) . $tmpfile;
                     if ($this->ImageResize) {
                         $wrkwidth = $this->ImageWidth;
                         $wrkheight = $this->ImageHeight;
                         $wrkdata = ewr_ResizeFileToBinary($imagefn, $wrkwidth, $wrkheight, $this->ResizeQuality);
                         if ($tmpimage != "") {
                             $tmpimage .= ",";
                         }
                         $tmpimage .= ewr_TmpImage($wrkdata);
                     } else {
                         if ($tmpimage != "") {
                             $tmpimage .= ",";
                         }
                         $tmpimage .= ewr_ConvertFullUrl($this->UploadPath . $tmpfile);
                     }
                 }
             }
             return $tmpimage;
         }
     }
 }