Location: PHPKode > scripts > Image Resizing script > Resize/image_resize.php
<?php session_start(); ob_start();  ?>
<html>
<head>
<title>Quick Query</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<link href="style/ajs.css" rel="stylesheet" type="text/css" />
<link href="style/ajs.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form method="post" name=form1 action="imagefunction.php" enctype="multipart/form-data">

<table width="100%%" border="0" align="center" cellpadding="0" cellspacing="0" background="images/bg.jpg" style=" border-left:1px solid #7f7f7f; border-right:1px solid #7f7f7f; border-bottom:1px solid #7f7f7f; ">
  
  <tr>
    <td colspan="10"><img src="http://www.ajsquare.com/images/logo_form.jpg" width="179" height="80" /></td>
  </tr>
  
  <tr>
    <td colspan="2">&nbsp;</td>
    <td colspan="8">&nbsp;</td>
  </tr>
  <tr>
    <td width="2%" bgcolor="#EDEEFC" style="border-bottom:1px solid #cccccc; border-top:1px solid #cccccc">&nbsp;</td>
    <td width="15%" bgcolor="#EDEEFC" style="border-bottom:1px solid #cccccc;border-top:1px solid #cccccc"><b class="emailtxt">Quick Query </b></td>
    <td colspan="8" bgcolor="#EDEEFC" style="border-bottom:1px solid #cccccc;border-top:1px solid #cccccc">&nbsp;</td>
  </tr>
  
  <tr>
    <td colspan="2">&nbsp;</td>
    <td colspan="8">&nbsp;</td>
  </tr>
  
   <tr><td class="highlight1" align="center" colspan="6">
	  
	    <?php if($_SESSION['succ'] == "1"){ ?>
			Your image has been resized.
		<?php } ?>
		 <?php if($_SESSION['succ'] == "0"){ ?>
				<?php echo $_SESSION['errmsgs']; ?>
		Your image could not be resized. Image width should be below original width
		<?php } ?>
	  
	  </td></tr>
	  
  <tr>
    <td colspan="2">&nbsp;</td>
    <td colspan="8">&nbsp;</td>
  </tr>
  

  <tr>
    <td colspan="2">&nbsp;</td>
    <td width="33%" valign="top"><span class="text">Select the Image <font color="red">*</font>: </span></td>
    <td colspan="7"><input name="image_orig" type="file" class="text2"  /></td>
  </tr>
  <tr>
    <td colspan="10">&nbsp;</td>
  </tr>
  
    <tr>
    <td colspan="2">&nbsp;</td>
    <td width="33%" valign="top"><span class="text">Specify the Image width to which it should be resized <font color="red">*</font>: </span></td>
    <td colspan="7"><input name="resize_wid" type="text" class="text2"  /></td>
  </tr>
  <tr>
    <td colspan="10">&nbsp;</td>
  </tr>
  
  <tr>
    <td colspan="2">&nbsp;</td>
    <td valign="top">&nbsp;</td>
    <td width="11%"><input name="submit" type="submit" class="redbutton" value = "Submit" /></td>
    <td width="39%" colspan="6">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
    <td valign="top">&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan="6">&nbsp;</td>
  </tr>
</table>
</span>
</body>
	  <script language="JavaScript">
function validate()
{
//alert("hai");
//alert(document.form1.txtname.value);
	if(document.form1.txtname.value=="")
	{
		alert("Please Enter Your Name");
		document.form1.txtname.focus();
		return false;
	}
	
	if(document.form1.txtname.value!="")
	{
		var b = charonly(document.form1.txtname.value);
		if(b == false)
		{
			alert("Please Enter valid Name");
			document.form1.txtname.focus();
			return false;
		}
	}
	
	//exit();
	if(document.form1.txtphone.value=="")
	{
		alert("Please Enter Your Phone Number");
		document.form1.txtphone.focus();
		return false;
	}
	phoneno = document.form1.txtphone.value;
	len = phoneno.length;
	if(len > 0)
	{
		for(i=0;i<len;i++)
		{
			x = phoneno.substr(i,1)
			if( !( (x >= '0' && x <= '9') || x == '-') )
			{
				alert("Please Enter the valid Phone number");
				document.form1.txtphone.focus();
				document.form1.txtphone.select();
				return false;
			}
		}
	}
	if(document.form1.txtemail.value=="")
	{
		alert("Please Enter Your Email Id");
		document.form1.txtemail.focus();
		return false;
	}
	if( !isEmail(document.form1.txtemail.value) )
	{
		alert("Please Enter the Valid Email Id");
		document.form1.txtemail.focus();
		document.form1.txtemail.select();
		return false;
	}
	if(document.form1.txtpurpose.value=="")
	{
		alert("Please Enter the Purpose");
		document.form1.txtpurpose.focus();
		return false;
	}
	
	if(document.form1.txtcomment.value=="")
	{
		alert("Please Enter the Query ");
		document.form1.txtcomment.focus();
		return false;
	}
	/*if(document.form1.txtSeccode.value=="")
	{
		alert("Please Enter the Turing Code ");
		document.form1.txtSeccode.focus();
		return false;
	}
	else
	{
	if(document.form1.txtSeccode.value!="a5396")
	{
	 alert("Please Enter the Valid Turing Code");
	 return false;
	}
	//return false;
	}*/
	return true;
}


function isEmail(emailstr)
{
	dotchar = emailstr.indexOf(".");
	atchar = emailstr.indexOf("@");
	dotlast = emailstr.lastIndexOf(".");
	spacechar = emailstr.indexOf(" ");
	len = emailstr.length;
	if( (dotchar == -1) || (atchar == -1) || (spacechar != -1) || (dotlast < atchar) || (dotlast == len - 1) )
	{
		return false;
	}
	else
	{
		return true;
	}
}
function charonly(word)
{
   var wlen=word.length;
   for(var j=0;j < wlen;j++)
   {
	   
			m = word.charCodeAt(j);			
			if(!((m>=97 && m<=122 )||(m>=65 && m<=90)||(m==32)))
	        {				
				return false;
			}
   }
  return true;
}
</script>

<script src="include/func.js" type="text/javascript"></script>

Return current item: Image Resizing script