PDA

View Full Version : Image upload and resize



Rickzkm
21 May 2006, 09:06 AM
Hi everyone,

I have this script and i would need to upload image (keep it in original size and than create thumbnail to certain ratio )
I would appreciate very much if you could help me.


<?php
if(isset($_POST['submit']))
{

include '../library/config.php';
include '../library/opendb.php';

$title = $_POST['title'];
$popis = $_POST['popis'];
$date = $_POST['date'];
$image = $_POST['image'];

$query = "INSERT INTO aktivity ( title, popis, date, image)
VALUES('$title','$popis','$date','$image')";
$result = mysql_query($query);
echo "<b><font color=\"#00CC00\" size=\"4\" face=\"Trebuchet MS\"> Nova aktivita pridana </font><br><br>
<input type=\"submit\" name=\"submit3\" value=\" vypsat vsechny aktivity \" onClick=\"goToURLlist()\"></b>";



include '../library/closedb.php';
}
else
{
?>
<form enctype="multipart/form-data" action="<?=$_SERVER['PHP_SELF']?>" method="POST">
<table width="100%" cellpadding="2" cellspacing="2">
<tr>
<td width="27%">Nazev aktivity: </td>
<td width="73%"><input type="text" name="title" id="title"></td>
</tr>
<tr>
<td><label>Popis:</label></td>
<td><input type="text" name="popis" id="popis"></td>
</tr>
<tr>
<td><label>Datum:</label></td>
<td><input type="text" name="date" id="date"></td>
</tr>
<tr>
<td>Obrazek:</td>
<td><input type="hidden" name="MAX_FILE_SIZE" value="25000"><input type="file" name="imgfile">
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input name="submit" type="submit" id="submit" value=" Přidat novou aktivitu "></td>
</tr>
</table>
</form>
<?php
}
?>

Thank you.