Resizing images using SimpleImage in PHP
<p>I'm using <code>SimpleImage</code> to resize images in PHP. I need to resize the images uploaded via a form using the file browse. I use the following approach to resize the image uploaded via a file browse.</p>

<pre><code>$image=new SimpleImage();
$image-&gt;load($_FILES['txt_brand_img']['tmp_name']); //It isn't working.

if($image-&gt;getWidth()&gt;500)
{
$image-&gt;resizeToWidth(500);
$image-&gt;save("images_db/".$filename);
}
</code></pre>

<p>It isn't working. I could see somewhat resemble approach <a href="http://stackoverflow.com/questions/8638593/uploading-to-mysql-and-using-simpleimage-php">here</a> but it didn't work for me. When I upload and save the image in a directory and give the saved file path to the <code>load()</code> function as follows it is working.</p>

<pre><code>$filename=rand(1000,1000000).$_FILES["txt_brand_img"]["name"];
move_uploaded_file($_FILES["txt_brand_img"]["tmp_name"],"images_db/".$filename);

    $image=new SimpleImage();                       
    $image-&gt;load("images_db/".$filename);   //It is working.
    if($image-&gt;getHeight()&gt;100 || $image-&gt;getWidth()&gt;100)
    {                               
            $image-&gt;resize(100, 100);
        $image-&gt;save("images_db/thumb/".$filename);
    }
    else
    {
        $image-&gt;save("images_db/thumb/".$filename); 
    }
</code></pre>

<p>May I be using a wrong approach in the previous code snippet? How could the uploaded images be directly resized without saving them using <code>SimpleImage</code>?    </p>
