images
This commit is contained in:
@@ -1,11 +1,37 @@
|
||||
<?php
|
||||
|
||||
include_once( "class.upload.php" );
|
||||
|
||||
$user = "ckoch";
|
||||
$target_dir = "community/uploads/" . $user . "/";
|
||||
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
|
||||
$uploadOk = 1;
|
||||
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
|
||||
//$_FILES["fileToUpload"]
|
||||
|
||||
$handle = new upload( $_FILES["fileToUpload"] );
|
||||
|
||||
$newFileName = hash("sha256", $user . time() );
|
||||
|
||||
if( $handle->uploaded ){
|
||||
$handle->file_new_name_body = $newFileName;
|
||||
$handle->image_resize = true;
|
||||
$handle->image_x = 250;
|
||||
$handle->image_ratio_y = true;
|
||||
$handle->image_convert = 'png';
|
||||
$handle->process( $target_dir );
|
||||
|
||||
if( $handle->processed ){
|
||||
$handle->clean();
|
||||
echo $newFileName;
|
||||
}else{
|
||||
echo 'error : ' . $handle->error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// Check if image file is a actual image or fake image
|
||||
//if(isset($_POST["submit"])) {
|
||||
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
|
||||
@@ -49,4 +75,5 @@ if ($uploadOk == 0) {
|
||||
echo( 0 );
|
||||
}
|
||||
}
|
||||
*/
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user