How do you upload and resize an image with PHP?

<form enctype="multipart/form-data" action="add.php" method="POST">

<input type="file" name="photo"><br>

<input type="submit" name="sub" value="Add" action="page">

<input type='hidden' id='Id' value='{$Id} name="id"/>

</form

/////////////////////php coding

<?php

//////include these files

require "includes/common.php";

require_once("includes/config.php");

global $global_config;

$objCommonQueries = new CommonQueries();

$employee_attachments = "employee_attachments";///table name

$target = $global_config["doc_path"];

$target = $target .basename( $_FILES['uploaded']['name']) ;

$ok=1;

if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))

{

echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";

}

else

{

echo "Sorry, there was a problem uploading your file.";

}

$uploaded_size = $_FILES['uploaded']['size'];

if ($uploaded_size > 350000)

{

echo "Your file is too large.<br>";

$ok=0;

}

$currentdate = date('Y-M-D h:i:s');

$filename = $_FILES['uploaded']['name'];

$id = '2';

you can save these uplaoad image in which database you need and can display

?>

//fetch the image from database and assign to smarty variable $getimage

<div style="width:150px; float:left;margin-left:20%;margin-bottom:5px;">

<div><img src="{$getimage}" style="width:125px; float:left; height:175px; margin-left:9%;margin-bottom:5px; background:#f2f2f2; border:1px solid #cccccc"> &nbsp; </div>

<div align="center"> <input type="button" class="button" value="Browse" /></div>

</div>