Problem using imagecreatefromjpeg and imagejpeg
<p>As per an assignment given to me, I am trying to see the effects of the following two function of php on a image file
1. imagecreatefromjpeg
2. imagejpeg</p>

<p>I upload the file using a html and then my php code looks like this:</p>

<pre><code> &lt;?php

 try{
   if(!$image=imagecreatefromjpeg('zee1.jpg')){
      throw new Exception('Error loading image');
   }
   // create text color for jpg image
   if(!$textColor=imagecolorallocate($image,0,255,0)){
      throw new Exception('Error creating text color');
   }
   // include text string into jpg image
   if(!$text=imagestring($image,5,10,90,'This is a sample text
string.',$textColor)){
      throw new Exception('Error creating image text');
   }
   header("Content-type:image/jpeg");
   // display image
   imagejpeg($image, 'zee1After.jpg');
   // free up memory
   imagedestroy($image);
}
catch(Exception $e){
   echo $e-&gt;getMessage();
   exit();
}

    ?&gt;
</code></pre>

<p>But when i do this, i get the following output:</p>

<p>Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 10368 bytes) in C:\Users\zee\Documents\Flex Builder 3\CLOUD\bin-debug\upload_file.php on line 3</p>

<p>The size of original image is : 5,136 KB give the above error after running the php. </p>

<p>But if i try for other image with size : 2,752 KB     It Works .. </p>

<p>Can someone please help me with this. 
Zeeshan</p>
