Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8092757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:21:18+00:00 2026-06-05T20:21:18+00:00

i am created one function to upload image with random name and it worked

  • 0

i am created one function to upload image with random name and it worked properly.

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;
    }
}

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

i try this function but its giving error.

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;
    }
}

this function is not working.

i just want to create a thumb of 75 on same folder with name start with t_

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:21:20+00:00Added an answer on June 5, 2026 at 8:21 pm

    You didn’t specify the filename of destination image. Replace this line,

    $dest = $path;
    

    with this:

    $dest = $path.'t_'.$f_name;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have created one jQuery function to check if elements exist or not
I have created one multiplication of complex function using prototype in java-script function ComplexNumber(real,imaginary)
Using xlwDotNet, I have created a simple function which returns one number. Sometimes, something
Django's get_or_create function always cause get() returned more than one Model name error in
I have recently created an upload function, but I don't know how to change
I've created a javascript function that allows me to validate if one field or
I have created one thread for calling native function which are calling the MPEG2
I want to add functionality to check session ao. I created one function like
i got a question when create a javascript object, when one function invoking another
I have a win form that creates a site in IIS7. One function needs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.