Posted by Kode Fri 23rd Feb 2007 18:29 - Syntax is PHP - 16 views
Download | New Post | Modify | Hide line numbers
Download | New Post | Modify | Hide line numbers
PHP parser reported no syntax errors in this post!
-
-
function backstr($haystack, $needle) {
-
}
-
-
// Return random image code
-
-
function image_createThumb($src,$dest,$maxWidth,$maxHeight,$quality=100) {
-
// path info
-
-
// image src size
-
-
// image dest size $destSize = width, $destSize = height
-
$srcRatio = $srcSize[0]/$srcSize[1]; // width/height ratio
-
$destRatio = $maxWidth/$maxHeight;
-
if ($destRatio > $srcRatio) {
-
$destSize[1] = $maxHeight;
-
$destSize[0] = $maxHeight*$srcRatio;
-
}
-
else {
-
$destSize[0] = $maxWidth;
-
$destSize[1] = $maxWidth/$srcRatio;
-
}
-
-
// path rectification
-
if ($destInfo['extension'] == "gif") {
-
}
-
-
// true color image, with anti-aliasing
-
$destImage = imageCreateTrueColor($destSize[0],$destSize[1]);
-
imageAntiAlias($destImage,true);
-
-
// src image
-
switch ($srcSize[2]) {
-
case 1: //GIF
-
$srcImage = imageCreateFromGif($src);
-
break;
-
-
case 2: //JPEG
-
$srcImage = imageCreateFromJpeg($src);
-
break;
-
-
case 3: //PNG
-
$srcImage = imageCreateFromPng($src);
-
break;
-
-
default:
-
return false;
-
break;
-
}
-
-
// resampling
-
imageCopyResampled($destImage, $srcImage, 0, 0, 0, 0,$destSize[0],$destSize[1],$srcSize[0],$srcSize[1]);
-
-
// generating image
-
switch ($srcSize[2]) {
-
case 1:
-
case 2:
-
imageJpeg($destImage,$dest,$quality);
-
break;
-
-
case 3:
-
imagePng($destImage,$dest);
-
break;
-
}
-
return true;
-
}
-
else {
-
return false;
-
}
-
}
-
function _execute_image_thumb($src, $dst, $height, $width) {
-
image_createThumb($src, $dst,$height,$width);
-
}
-
function options_myimages() {
-
$succ = "false";
-
$user_var = $_SESSION["nicename"];
-
$dirpref = "../members/";
-
$dirthumb = "/thumb";
-
$delpic = $_GET['delpic'];
-
$setpic = $_GET['setasmain'];
-
$picid = $_GET['picid'];
-
}
-
image_createThumb($dirpref.$user_var."/".$picid, $dirpref.$user_var.$dirthumb."/NPHM_site_main.jpg","184","184");
-
}
-
$dir = $dirpref.$user_var;
-
if ($_GET['action'] == "update") {
-
}
-
}
-
//$dir = "path/where/you/want/to/upload/files/"; //Change this to the correct dir
-
//MIME types to allow, Gif, jpeg, zip ::Edit this to your liking
-
//Check to determine if the submit button has been pressed
-
//Shorten Variables
-
$tmp_name = $_FILES['upload']['tmp_name'];
-
$new_name = $_FILES['upload']['name'];
-
//Check MIME Type
-
//Move file from tmp dir to new location
-
-
// echo 'something'; flush();
-
-
}
-
// echo 'something'; flush();
-
echo " was uploaded sucessfully!";
-
//echo $dirpref.$user_var."/".$new_name, $dirpref.$user_var.$dirthumb."/".$new_name;
-
image_createThumb($dirpref.$user_var."/".$new_name, $dirpref.$user_var.$dirthumb."/".$new_name,"120","120");
-
-
-
} else {
-
//Print Error Message
-
echo "File Was Not Uploaded!
"; -
//Debug
-
$name = $_FILES['upload']['name'];
-
$type = $_FILES['upload']['type'];
-
$size = $_FILES['upload']['size'];
-
$tmp = $_FILES['upload']['name'];
-
echo "Name: $name
Type: $type
Size: $size
Tmp: $tmp"; -
-
}
-
} else {
-
echo 'Could Not Upload Files';
-
-
}
-
}
-
-
-
echo "Here at NPHM we has an open policy to nakedness.
"; -
echo "In fact we openly encourage users to upload pics with the channel name written on their naked body
"; -
echo "However, we do ask that they are tasteful, and ANY pictures of this type MUST have [nsfw] in the filename
"; -
echo "i.e. mytoplesspic[nsfw].jpg or [nsfw]toplesspic.jpg this ensures casual visitors dont stumble across them.
"; -
echo "Any users not respecting this policy may be removed";
-
file\" name=\"upload\" />
-
\"submit\" name=\"submit\" value=\"Upload Files\" />
-
";
-
-
echo "Main Pic
"; -
$nphmfile = "../members/$user_var/thumb/NPHM_site_main.jpg";
-
$main_img = "\"$nphmfile\" alt=\"NPHM_site_main.jpg\" />
If you have updated the main pic, click refresh in your browser.
"; -
} else {
-
$main_img = "No Pic set as Main
"; -
}
-
echo $main_img;
-
$a = '0';
-
$filepath = "$dirpref$user_var$dirthumb";
-
$url_path = "$dirpref$user_var";
-
$userpic = "
\"center\" border=\"0\" cellpadding=\"5\" cellspacing=\"5\" width=\"100%\">";
";while($entry=$dir->read()) {if($entry == "." || $entry == ".." || $entry == "NPHM_site_main.jpg") {continue;}// $fp = @fopen("$filepath/$entry","r");if ($a == '0') { $userpic .= ""; } ";$userpic .= "\"top\" id='n'> ";\"center\">\"$url_path/$entry\">\"$filepath/$entry\" alt=\"$entry\">\"center\">\"?page=pictures&delpic=true&picid=$entry\">delete |\"?page=pictures&setasmain=true&picid=$entry\">Set as Main$a = $a + 1;if ($a == '3') {$a = 0;$userpic .= "}}$userpic .= " -
} else {
-
$userpic = "\"center\">No Pics";
-
}
-
echo $userpic;
-
-
//echo $dirpref.$user_var."/".$new_name, $dirpref.$user_var.$dirthumb."/".$new_name;
-
-
}
-
if ($_SESSION["nickname"]) {
-
options_myimages();
-
}
-
?>
PermaLink to this entry https://pastebin.co.uk/10850
Posted by Kode Fri 23rd Feb 2007 18:29 - Syntax is PHP - 16 views
Download | New Post | Modify | Hide line numbers
Download | New Post | Modify | Hide line numbers
Comments: 0