Witam

!
Chce przesłać do skryptu wybraną fotkę.
Jeśli jest w tym samym katalogu i method="get" to jest oki -- tylko dla fotki z tego samego katalogu. A jeśli jest method="post" to wartość zmiennej oka jest taka: C:\DOCUME~1\Mariusz\USTAWI~1\Temp\php27.tmp
Co zrobić żeby działało z innego katalogu ?
a to kod
<form action="index.php" method="post" enctype="multipart/form-data">
<input type="file" name="oka" size="20">
<input type="submit" value="Wyślij">
</form>
<?php
print"<br /><br /><br />";
function imgType($name)
{
if(substr($name, -4, 4) == '.jpg' || substr($name, -4, 4) == 'jpeg') {
return IMAGETYPE_JPEG;
}
elseif(substr($name, -4, 4) == '.gif') {
return IMAGETYPE_GIF;
}
elseif(substr($name, -4, 4) == '.png') {
return IMAGETYPE_PNG;
}
}
function resizeImage($source, $max_x, $max_y, $save_image, $jpeg_quality = 100)
{
if(imgType($source) == IMAGETYPE_JPEG)
{
$img_src = imagecreatefromjpeg($source);
}
elseif(imgType($source) == IMAGETYPE_GIF)
{
$img_src = imagecreatefromgif($source);
}
elseif(imgType($source) == IMAGETYPE_PNG)
{
$img_src = imagecreatefrompng($source);
}
else
{
die('Wrong filetype! Accepted images: JPG/JPEG, GIF, PNG'); }
$image_x = imagesx($img_src);
$image_y = imagesy($img_src);
if($image_x > $image_y) // Landscape
{
$ratio_x = ($image_x > $max_x) ? $max_x/$image_x : 1;
$ratio_y = $ratio_x;
$move = 'y';
}
else // Portrait
{
$ratio_y = ($image_y > $max_y) ? $max_y/$image_y : 1;
$ratio_x = $ratio_y;
$move = 'x';
}
$new_x = $image_x*$ratio_x;
$new_y = $image_y*$ratio_y;
$move_x = ($move == "x") ? ($max_x-$new_x)/2 : 0;
$move_y = ($move == "y") ? ($new_y-$new_y)/2 : 0;// z new na max_y
$new_img = imagecreatetruecolor($max_x, $new_y);///zmiana max_y
$background = imagecolorallocate($new_img, 155, 155, 155);
imagefill($new_img, 0, 0, $background);
imagecopyresampled($new_img, $img_src, $move_x, $move_y, 0, 0, $new_x, $new_y, $image_x, $image_y);
if(imgType($save_image) == IMAGETYPE_JPEG)
{
imagejpeg($new_img, $save_image, 100);
}
elseif(imgType($save_image) == IMAGETYPE_GIF)
{
imagegif($new_img, $save_image);
}
elseif(imgType($save_image) == IMAGETYPE_PNG)
{
imagepng($new_img, $save_image);
}
echo "<img src="".$save_image."" border="1">";
}
resizeImage($oka, 120, 160, 'nowafotka.jpg', 56);
?>