Ejemplo n.º 1
0
 function Page_Main()
 {
     global $conn;
     $GLOBALS["Page"] =& $this;
     //***$conn = ew_Connect();
     // Get fn / table name parameters
     $key = EW_RANDOM_KEY . session_id();
     $fn = @$_GET["fn"] != "" ? ew_StripSlashes($_GET["fn"]) : "";
     if ($fn != "" && EW_ENCRYPT_FILE_PATH) {
         $fn = ew_Decrypt($fn, $key);
     }
     $table = @$_GET["t"] != "" ? ew_StripSlashes($_GET["t"]) : "";
     if ($table != "" && EW_ENCRYPT_FILE_PATH) {
         $table = ew_Decrypt($table, $key);
     }
     // Global Page Loading event (in userfn*.php)
     //***Page_Loading();
     // Get resize parameters
     $resize = @$_GET["resize"] != "";
     $width = @$_GET["width"] != "" ? $_GET["width"] : 0;
     $height = @$_GET["height"] != "" ? $_GET["height"] : 0;
     if (@$_GET["width"] == "" && @$_GET["height"] == "") {
         $width = EW_THUMBNAIL_DEFAULT_WIDTH;
         $height = EW_THUMBNAIL_DEFAULT_HEIGHT;
     }
     // Resize image from physical file
     if ($fn != "") {
         $fn = str_replace("", "", $fn);
         $fn = ew_IncludeTrailingDelimiter(ew_AppRoot(), TRUE) . $fn;
         if (file_exists($fn) || @fopen($fn, "rb") !== FALSE) {
             // Allow remote file
             if (ob_get_length()) {
                 ob_end_clean();
             }
             $pathinfo = pathinfo($fn);
             $ext = strtolower(@$pathinfo["extension"]);
             $ct = ew_ContentType("", $fn);
             if ($ct != "") {
                 header("Content-type: " . $ct);
             }
             if (in_array($ext, explode(",", EW_IMAGE_ALLOWED_FILE_EXT))) {
                 $size = @getimagesize($fn);
                 if ($size) {
                     header("Content-type: {$size['mime']}");
                 }
                 if ($width > 0 || $height > 0) {
                     echo ew_ResizeFileToBinary($fn, $width, $height);
                 } else {
                     echo file_get_contents($fn);
                 }
             } elseif (in_array($ext, explode(",", EW_DOWNLOAD_ALLOWED_FILE_EXT))) {
                 echo file_get_contents($fn);
             }
         }
     }
     // Global Page Unloaded event (in userfn*.php)
     //***Page_Unloaded();
     // Close connection
     //***ew_CloseConn();
 }
Ejemplo n.º 2
0
include_once "ewcfg11.php";
include_once "adodb5/adodb.inc.php";
include_once "phpfn11.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 = EW_THUMBNAIL_DEFAULT_WIDTH;
    $height = EW_THUMBNAIL_DEFAULT_HEIGHT;
}
$quality = @$_GET["quality"] != "" ? $_GET["quality"] : EW_THUMBNAIL_DEFAULT_QUALITY;
// Resize image from physical file
if (@$_GET["fn"] != "") {
    $fn = ew_StripSlashes($_GET["fn"]);
    $fn = str_replace("", "", $fn);
    $fn = ew_IncludeTrailingDelimiter(ew_AppRoot(), TRUE) . $fn;
    if (file_exists($fn) || fopen($fn, "rb") !== FALSE) {
        // Allow remote file
        $pathinfo = pathinfo($fn);
        $ext = strtolower(@$pathinfo["extension"]);
        if (in_array($ext, explode(",", EW_IMAGE_ALLOWED_FILE_EXT))) {
            $size = @getimagesize($fn);
            if ($size) {
                header("Content-type: {$size['mime']}");
            }
            echo ew_ResizeFileToBinary($fn, $width, $height, $quality);
        }
    }
    exit;
}
Ejemplo n.º 3
0
 function ExportValue($Export, $Original)
 {
     $ExportValue = $Original ? $this->CurrentValue : $this->ViewValue;
     if ($Export == "xml" && is_null($ExportValue)) {
         $ExportValue = "<Null>";
     }
     if ($Export == "pdf") {
         if ($this->FldViewTag == "IMAGE") {
             if ($this->FldDataType == EW_DATATYPE_BLOB) {
                 $wrkdata = $this->Upload->DbValue;
                 if (!empty($wrkdata)) {
                     if ($this->ImageResize) {
                         $wrkwidth = $this->ImageWidth;
                         $wrkheight = $this->ImageHeight;
                         ew_ResizeBinary($wrkdata, $wrkwidth, $wrkheight, $this->ResizeQuality);
                     }
                     $imagefn = ew_TmpImage($wrkdata);
                     if ($imagefn != "") {
                         $ExportValue = "<img src=\"" . $imagefn . "\">";
                     }
                 }
             } else {
                 $wrkfile = $this->Upload->DbValue;
                 if (empty($wrkfile)) {
                     $wrkfile = $this->CurrentValue;
                 }
                 if (!empty($wrkfile)) {
                     $imagefn = ew_UploadPathEx(TRUE, $this->UploadPath) . $wrkfile;
                     if ($this->ImageResize) {
                         $wrkwidth = $this->ImageWidth;
                         $wrkheight = $this->ImageHeight;
                         $wrkdata = ew_ResizeFileToBinary($imagefn, $wrkwidth, $wrkheight, $this->ResizeQuality);
                         $imagefn = ew_TmpImage($wrkdata);
                     } else {
                         $imagefn = ew_TmpFile($imagefn);
                     }
                     if ($imagefn != "") {
                         $ExportValue = "<img src=\"" . $imagefn . "\">";
                     }
                 }
             }
         } else {
             $ExportValue = str_replace("<br>", "\r\n", $ExportValue);
             $ExportValue = strip_tags($ExportValue);
             $ExportValue = str_replace("\r\n", "<br>", $ExportValue);
         }
     }
     return $ExportValue;
 }
Ejemplo n.º 4
0
 function GetTempImage()
 {
     if ($this->FldDataType == EW_DATATYPE_BLOB) {
         $wrkdata = $this->Upload->DbValue;
         if (!empty($wrkdata)) {
             if ($this->ImageResize) {
                 $wrkwidth = $this->ImageWidth;
                 $wrkheight = $this->ImageHeight;
                 ew_ResizeBinary($wrkdata, $wrkwidth, $wrkheight);
             }
             return ew_TmpImage($wrkdata);
         }
     } else {
         $wrkfile = $this->Upload->DbValue;
         if (empty($wrkfile)) {
             $wrkfile = $this->CurrentValue;
         }
         if (!empty($wrkfile)) {
             if (!$this->UploadMultiple) {
                 $imagefn = ew_UploadPathEx(TRUE, $this->UploadPath) . $wrkfile;
                 if ($this->ImageResize) {
                     $wrkwidth = $this->ImageWidth;
                     $wrkheight = $this->ImageHeight;
                     $wrkdata = ew_ResizeFileToBinary($imagefn, $wrkwidth, $wrkheight);
                     return ew_TmpImage($wrkdata);
                 } else {
                     return $imagefn;
                 }
             } else {
                 $tmpfiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $wrkfile);
                 $tmpimage = "";
                 foreach ($tmpfiles as $tmpfile) {
                     if ($tmpfile != "") {
                         $imagefn = ew_UploadPathEx(TRUE, $this->UploadPath) . $tmpfile;
                         if ($this->ImageResize) {
                             $wrkwidth = $this->ImageWidth;
                             $wrkheight = $this->ImageHeight;
                             $wrkdata = ew_ResizeFileToBinary($imagefn, $wrkwidth, $wrkheight);
                             if ($tmpimage != "") {
                                 $tmpimage .= ",";
                             }
                             $tmpimage .= ew_TmpImage($wrkdata);
                         } else {
                             if ($tmpimage != "") {
                                 $tmpimage .= ",";
                             }
                             $tmpimage .= ew_ConvertFullUrl($this->UploadPath . $tmpfile);
                         }
                     }
                 }
                 return $tmpimage;
             }
         }
     }
 }
Ejemplo n.º 5
0
 function Resize($width, $height, $quality)
 {
     if (!is_null($this->Value)) {
         $wrkwidth = $width;
         $wrkheight = $height;
         if ($this->IsBinary) {
             $this->Binary = ew_ResizeFileToBinary($this->Value, $wrkwidth, $wrkheight, $quality);
             $this->FileSize = strlen($this->Binary);
         } else {
             ew_ResizeFile($this->Value, $this->Value, $wrkwidth, $wrkheight, $quality);
             $this->FileSize = filesize($this->Value);
         }
         $this->ImageWidth = $wrkwidth;
         $this->ImageHeight = $wrkheight;
     }
 }
Ejemplo n.º 6
0
 function GetTempImage()
 {
     if ($this->FldDataType == EW_DATATYPE_BLOB) {
         $wrkdata = $this->Upload->DbValue;
         if (!empty($wrkdata)) {
             if ($this->ImageResize) {
                 $wrkwidth = $this->ImageWidth;
                 $wrkheight = $this->ImageHeight;
                 ew_ResizeBinary($wrkdata, $wrkwidth, $wrkheight, $this->ResizeQuality);
             }
             return ew_TmpImage($wrkdata);
         }
     } else {
         $wrkfile = $this->Upload->DbValue;
         if (empty($wrkfile)) {
             $wrkfile = $this->CurrentValue;
         }
         if (!empty($wrkfile)) {
             $imagefn = ew_UploadPathEx(TRUE, $this->UploadPath) . $wrkfile;
             if ($this->ImageResize) {
                 $wrkwidth = $this->ImageWidth;
                 $wrkheight = $this->ImageHeight;
                 $wrkdata = ew_ResizeFileToBinary($imagefn, $wrkwidth, $wrkheight, $this->ResizeQuality);
                 return ew_TmpImage($wrkdata);
             } else {
                 return $imagefn;
             }
         }
     }
 }