本文整理汇总了PHP中ew_ContentType函数的典型用法代码示例。如果您正苦于以下问题:PHP ew_ContentType函数的具体用法?PHP ew_ContentType怎么用?PHP ew_ContentType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ew_ContentType函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Page_Main
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();
}
示例2: UploadFile
function UploadFile()
{
global $objForm;
$this->Value = NULL;
// Reset first
$fldvar = $this->Index < 0 ? $this->FldVar : substr($this->FldVar, 0, 1) . $this->Index . substr($this->FldVar, 1);
$wrkvar = "fn_" . $fldvar;
$this->FileName = @$_POST[$wrkvar];
// Get file name
$wrkvar = "fa_" . $fldvar;
$this->KeepFile = @$_POST[$wrkvar] == "1";
// Check if keep old file
if (!$this->KeepFile && $this->FileName != "" && !$this->UploadMultiple) {
$f = ew_UploadTempPath($fldvar, $this->TblVar) . EW_PATH_DELIMITER . $this->FileName;
if (file_exists($f)) {
$this->Value = file_get_contents($f);
$this->FileSize = filesize($f);
$this->ContentType = ew_ContentType(substr($this->Value, 0, 11), $f);
$sizes = @getimagesize($f);
$this->ImageWidth = @$sizes[0];
$this->ImageHeight = @$sizes[1];
}
}
return TRUE;
// Normal return
}
示例3: Page_Main
function Page_Main()
{
// Get key
if (@$_GET["rider_id"] != "") {
$this->rider_id->setQueryStringValue($_GET["rider_id"]);
} else {
$this->Page_Terminate();
// Exit
exit;
}
$objBinary = new cUpload('rider', 'x_rider_pic');
// Show thumbnail
$bShowThumbnail = @$_GET["showthumbnail"] == "1";
if (@$_GET["thumbnailwidth"] == "" && @$_GET["thumbnailheight"] == "") {
$iThumbnailWidth = EW_THUMBNAIL_DEFAULT_WIDTH;
// Set default width
$iThumbnailHeight = EW_THUMBNAIL_DEFAULT_HEIGHT;
// Set default height
} else {
if (@$_GET["thumbnailwidth"] != "") {
$iThumbnailWidth = $_GET["thumbnailwidth"];
if (!is_numeric($iThumbnailWidth) || $iThumbnailWidth < 0) {
$iThumbnailWidth = 0;
}
}
if (@$_GET["thumbnailheight"] != "") {
$iThumbnailHeight = $_GET["thumbnailheight"];
if (!is_numeric($iThumbnailHeight) || $iThumbnailHeight < 0) {
$iThumbnailHeight = 0;
}
}
}
$sFilter = $this->KeyFilter();
// Set up filter (SQL WHERE clause) and get return SQL
// SQL constructor in rider class, riderinfo.php
$this->CurrentFilter = $sFilter;
$sSql = $this->SQL();
$conn =& $this->Connection();
if ($this->Recordset = $conn->Execute($sSql)) {
if (!$this->Recordset->EOF) {
if (ob_get_length()) {
ob_end_clean();
}
$objBinary->Value = $this->Recordset->fields('rider_pic');
$objBinary->Value = $objBinary->Value;
if ($bShowThumbnail) {
ew_ResizeBinary($objBinary->Value, $iThumbnailWidth, $iThumbnailHeight);
}
$data = $objBinary->Value;
if (strpos(ew_ServerVar("HTTP_USER_AGENT"), "MSIE") === FALSE) {
header("Content-type: " . ew_ContentType(substr($data, 0, 11), $this->Recordset->fields('rider_pic')));
}
if (trim(strval($this->Recordset->fields('rider_pic'))) != "") {
header("Content-Disposition: attachment; filename=\"" . $this->Recordset->fields('rider_pic') . "\"");
}
if (substr($data, 0, 2) == "PK" && strpos($data, "[Content_Types].xml") > 0 && strpos($data, "_rels") > 0 && strpos($data, "docProps") > 0) {
// Fix Office 2007 documents
if (substr($data, -4) != "") {
$data .= "";
}
}
echo $data;
}
$this->Recordset->Close();
}
}