php function to create thumb of uploaded image
<p>i am created one function to upload image with random name and it worked properly.</p>

<pre><code>function f_upload($file_name, $path)
{
    $ext=end(explode('.', $file_name['name']));

    $f_name=rand().time().'.'.$ext;

    if(move_uploaded_file($file_name['tmp_name'], $path.$f_name))
    {
        return $f_name; 
    }
    else
    {
        return false;
    }
}
</code></pre>

<p>now what i want is to create a thumb of same image with width of 75px on same directory but name start with <code>t_imagename</code></p>

<p>i try this function but its giving error.</p>

<pre><code>function f_upload_gallary($file_name, $path)
{
    $ext=end(explode('.', $file_name['name']));

    $f_name=rand().time().'.'.$ext;

    if(move_uploaded_file($file_name['tmp_name'], $path.$f_name))
    {

            $src=$path.$f_name;
            $desired_width=75;
            $dest=$path;
            $source_image = imagecreatefromjpeg($src);
            $width = imagesx($source_image);
            $height = imagesy($source_image);

            $desired_height = floor($height*($desired_width/$width));
            $virtual_image = imagecreatetruecolor($desired_width,$desired_height);
            imagecopyresized($virtual_image,$source_image,0,0,0,0,$desired_width,$desired_height,$width,$height);
            imagejpeg($virtual_image,$dest);


        return $f_name; 

    }
    else
    {
        return false;
    }
}
</code></pre>

<p>this function is not working.</p>

<p>i just want to create a thumb of 75 on same folder with name start with <strong>t_</strong></p>

<p>Thanks</p>
