Created
April 15, 2015 16:44
-
-
Save afnanenayet/ccc045ea13e3cf7107df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require("OrganizationHome.php"); | |
require("$OrganizationHome/SessionSpecifics.php"); | |
/* | |
$ConnectMsg = ConnectToDatabase(); | |
if ($ConnectMsg <> "") { | |
$_SESSION["MenuMsg"] = "Unable to connect to the database at this time..."; | |
header ("Location: Controller.php"); | |
exit; | |
} | |
*/ | |
//require("AllowLoggedIn.php"); | |
if (isset($_REQUEST['AcctId'])) { | |
$AcctId = $_REQUEST['AcctId']; | |
} else { | |
$AcctId = ''; | |
} | |
if (isset($_REQUEST['ImageName'])) { | |
$ImageName = $_REQUEST['ImageName']; | |
} else { | |
$ImageName = ''; | |
} | |
if (isset($_REQUEST['ImageSize'])) { | |
$ImageSize = $_REQUEST['ImageSize']; | |
} else { | |
$ImageSize = ''; | |
} | |
if ($AcctId <> '' and $ImageSize <> '' and $ImageName <> '') { | |
if ($ImageSize == '100') { | |
$Tag = '_Th100'; | |
} elseif ($ImageSize == '150') { | |
$Tag = '_Th150'; | |
} elseif ($ImageSize == '300') { | |
$Tag = '_Th300'; | |
} elseif ($ImageSize == '475') { | |
$Tag = '_Th475'; | |
} elseif ($ImageSize == '600') { | |
$Tag = '_Th600'; | |
} elseif ($ImageSize == 'Full') { | |
$Tag = ''; | |
} else { | |
$Tag = ''; | |
} | |
} else { | |
$Tag = 'Nope'; | |
} | |
$ImagePath = ''; | |
$ImageFileName = ''; | |
if ($Tag <> '') { | |
$TheDir = $OffWebDir . "AccountUploads/$AcctId/"; | |
if (is_dir($TheDir)) { | |
$ImageNameParts = explode('.', $ImageName); | |
$ImageFileName = $ImageNameParts[0] . $Tag . '.' . $ImageNameParts[1]; | |
} | |
$ImagePath = $TheDir . $ImageFileName; | |
} | |
//echo "Going after '$ImagePath'"; exit; | |
if ($ImagePath != '') { | |
$TheImage = file_get_contents($ImagePath); | |
if (!$TheImage) { | |
//echo 'No Image at $ImagePath'; | |
exit; | |
} else { | |
//$NameParts = explode('.',$ImageFileName); | |
$Ext = strtolower($ImageNameParts[1]); | |
if ($Ext == 'jpg') { | |
$ContentType = 'jpeg'; | |
} elseif ($Ext == 'png') { | |
$ContentType = 'png'; | |
} elseif ($Ext == 'gif') { | |
$ContentType = 'gif'; | |
} else { | |
$ContentType = ''; | |
} | |
if ($ContentType == '') { | |
echo "Unknown Content: Ext='$Ext' ImageFileName='$ImageFileName'"; | |
} else { | |
header("Content-type: image/$ContentType"); | |
echo $TheImage; | |
} | |
} | |
} | |
exit; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment