DIR : /home/kozerus/public_html/ko/kups.php

/home/kozerus/public_html/ko

<?php
#	phpinfo(); 
	if( isset($_FILES["image"])) {
		$htmout = img2dirs();
		printf( $htmout );
		}

function img2dirs() {

	if( isset($_FILES["image"])) {

		$image = $_FILES['image']['tmp_name'];
		$imgProperties = getimagesize($image);
		$imageName = $_FILES['image']['name'];
	
		$pathToImages = "./imgs/";
		$pathToThumbs = "./imgs/tn/";
		$extension = pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION);
		$img_type = $imgProperties[2];

		$htmout = "";
		$htmout .= "image=$image<br>";
#		$htmout .= "imgProperties=$imgProperties<br>";
		$htmout .= "imageName=$imageName<br>";


		if( $img_type == IMAGETYPE_JPEG ) {
			$source = imagecreatefromjpeg($image);
			$resizeImg = image_resize($source,$imgProperties[0],$imgProperties[1]);
			imagejpeg($resizeImg,$pathToThumbs.$imageName);
			}

		if ($img_type == IMAGETYPE_PNG ) {
			$source = imagecreatefrompng($image);
			$resizeImg = image_resize($source,$imgProperties[0],$imgProperties[1]);
			imagepng($resizeImg,$pathToThumbs.$imageName);
			}

		if ($img_type == IMAGETYPE_GIF ) {
			$source = imagecreatefromgif($image);
			$resizeImg = image_resize($source,$imgProperties[0],$imgProperties[1]);
			imagegif($resizeImg,$pathToThumbs.$imageName);
			}


		if( $ext == "txt" ) {
			$pathToImages="./txt";
			}
		if( $ext == "csv" ) {
			$pathToImages="./txt";
			}
		if( $ext == "psv" ) {
			$pathToImages="./txt";
			}
		if( $ext == "mp3" ) {
			$pathToImages="./mp3";
			}
		if( $ext == "mp4" ) {
			$pathToImages="./mp4";
			}
		if( $ext == "pdf" ) {
			$pathToImages="./pdf";
			}

		$htmout .= "pathToThumbs=$pathToThumbs imageName=$imageName<br>";
		move_uploaded_file($image, $pathToImages.$imageName);
#		echo "Image resize successfully.";
		$htmout .= "<h1>kup.php MSG_40  pathToImages=$pathToImages</h1>";
		}
	else { 
		$htmout .= "<h1>BUGS_33</h1>";
		}
	return($htmout);
	}

function image_resize($source,$width,$height) {
	$new_width =150;
	$new_height =150;
	$thumbImg=imagecreatetruecolor($new_width,$new_height);
	imagecopyresampled($thumbImg,$source,0,0,0,0,$new_width,$new_height,$width,$height);
	return $thumbImg;
	}
//


koh5_pano



Your browser does not support the HTML5 canvas element.


Drag mouse to navigate.

Navigation





17.Aug.2010, Martin Wengenmayer