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 5942223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:13:21+00:00 2026-05-22T16:13:21+00:00

I am new to jQuery but im loving it! ive have a problem i

  • 0

I am new to jQuery but im loving it! ive have a problem i cant get round as of yet.

I am using http://www.zurb.com/playground/ajax_upload

which i have got working using the following upload.php

    <?
$time= time();
$uploaddir = 'users/'; //<--  Changed this to my directory for storing images
$uploadfile = $uploaddir.$time.basename($_FILES['userfile']['name']); //<-- IMPORTANT

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    echo $uploaddir.$time.$_FILES['userfile']['name']; // IMPORTANT
    #print_r($_FILES);
} else {
  // WARNING! DO NOT USE "FALSE" STRING AS A RESPONSE!
  // Otherwise onSubmit event will not be fired
  echo "error";
}
?>

i have added the time variable to ensure each image is unique. The problem i have is i want to resize and optimise the image on the fly and i am not sure how to do this.

The resize is the most important featuer i require – for example i would like a max width of 300px for the image that is saved even if it was originally 1000px wide. I need to resize proportionaly ( is that a word? 🙂 )

Any help will be great.

Regards
M

  • 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-05-22T16:13:22+00:00Added an answer on May 22, 2026 at 4:13 pm

    To resize images you need libs like GD

    The standard function to do this is GD’s imagecopyresampled.

    In the example is shown one way to resize and keeping the proportion:

    //> MAx
    $width = 200;
    $height = 200;
    
    // Get new dimensions
    list($width_orig, $height_orig) = getimagesize($filename);
    
    $ratio_orig = $width_orig/$height_orig;
    
    if ($width/$height > $ratio_orig) {
       $width = $height*$ratio_orig;
    } else {
       $height = $width/$ratio_orig;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just set up my new homepage at http://ritter.vg . I'm using jQuery, but
I'm new to JQuery but for some reason I cant get the php code
I'm new to JQuery.But, I am trying to do this using it. I have
I'm pretty new to jQuery/JS. But I have loop in jQuery where I would
I'm new to jQuery dataTables and I'm overwhelmed. But now using it in a
I am new to jquery. I did come across http://komunitasweb.com/2009/09/3-amazing-jquery-color-picker-plugins/ but these plugins are
Ok, so I'm quite new to jQuery, but found this bizzare problem just now,
I'm new to jQuery but I managed to get something working. The only thing
I am new to jQuery but have a question I hope some of you
I'm new to jQuery but want to use this form validation plugin: http://bassistance.de/jquery-plugins/jquery-plugin-validation/ In

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.