title: Issue when uploading large images
body: <p>Hi I have this which I picked from a tutorial. <a href="http://www.ewebcodes.com/?p=149" rel="nofollow">Link here</a> Try help me understand this a bit.</p>
  
  <ol>
  <li><p>I want to know how the coder has attempted to control the size of the image uploading. (I've seen elsewhere in codes clearly restricting the size i.e <code>($_FILES["file"]["size"] &lt; 20000)</code>)</p></li>
  <li><p>Reason why im asking the above question is when I upload a smaller image this works fine but a larger image gives a series of Warnings!</p></li>
  </ol>
  
  <p>Thank you for your help.</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>&lt;?php
  
  function getExtension($str)
  {
   $i = strrpos($str,".");
   if (!$i) { return ""; }
  
   $l = strlen($str) - $i;
   $ext = substr($str,$i+1,$l);
   return $ext;
  }
  
  $image =$_FILES["imagefile"]["name"];
  $tempext = getExtension($image);
  $extfile= mt_rand().".".$tempext;
  $uploadedfile = $_FILES['imagefile']['tmp_name'];
  
  if ($extfile)
  {
  $filename = stripslashes($extfile);
  $extension = getExtension($filename);   // return the type of image
  $extension = strtolower($extension);    // convert result to lowercase
  if (($extension != "jpg") &amp;&amp; ($extension != "jpeg")
  &amp;&amp; ($extension != "png") &amp;&amp; ($extension != "gif"))
  {
  $errors=1;
  }
  else
  {
  $size=filesize($_FILES['imagefile']['tmp_name']);
  
  if($extension=="jpg" || $extension=="jpeg" )
  {
  $uploadedfile = $_FILES['imagefile']['tmp_name'];
  $src = imagecreatefromjpeg($uploadedfile);
  }
  else if($extension=="png")
  {
  $uploadedfile = $_FILES['imagefile']['tmp_name'];
  $src = imagecreatefrompng($uploadedfile);
  }
  else
  {
  $src = imagecreatefromgif($uploadedfile);
  }
  
  list($width,$height)=getimagesize($uploadedfile);
  
  $newwidth=600;
  $newheight=($height/$width)*$newwidth;
  $tmp=imagecreatetruecolor($newwidth,$newheight);
  imagecopyresampled($tmp,$src,0,0,0,0, $newwidth, $newheight, $width, $height);
  
  $newwidth1=185;
  $newheight1=($height/$width)*$newwidth1;
  $tmp1=imagecreatetruecolor($newwidth1,$newheight1);
  imagecopyresampled($tmp1,$src,0,0,0,0, $newwidth1, $newheight1, $width, $height);
  
  $filename = "upload/". $extfile;
  $filename1 = "upload/thumbs/". $extfile;  
  $etest1=imagejpeg($tmp,$filename,100);
  $etest2=imagejpeg($tmp1,$filename1,100);
  
  imagedestroy($src);
  imagedestroy($tmp);
  imagedestroy($tmp1);
  }
  }
  ?&gt;
  </code></pre>