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

  • SEARCH
  • Home
  • 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 4242410
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:26:17+00:00 2026-05-21T03:26:17+00:00

I am working on an upload script that also resizes/rescales an image. Currently it

  • 0

I am working on an upload script that also resizes/rescales an image.

Currently it is working by uploading the image, moving to the upload dir (site.com/upload) and then resizing, and afterwards deleting the original again…

Now my question is:
Can I do this without moving the original to the upload dir and even better, also keeping the new file in tmp so I the user can afterwards confirm the image (so If they don’t want it and just hit the ‘back’ button it won’t stay in the upload dir.)

Current code:

move_uploaded_file($_FILES['file']['tmp_name'], 'resize-upload/'.$_FILES['file']['name']);
$filename=$_FILES['file']['name'];    
$Imagick=new Imagick();
$Imagick-> readImage('resize-upload/'.$filename);
$Imagick-> scaleImage(200,200,auto);
$Imagick-> writeImage('resize-upload/resized-'.$filename);


unlink('resize-upload/'.$filename);
  • 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-21T03:26:18+00:00Added an answer on May 21, 2026 at 3:26 am

    You can’t. You don’t have the access to the image if you haven’t moved it yet. But you can generate more than one thumbnail at a time from same image/object and if you are storing/keeping the original also then you don’t need to unlink it either.

    Another way would be to use flash and resize the image on the client side and then only save the resized image.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im currently working on a site that you can upload large files.. on local
I have a script that runs to upload an image, then resize it into
I'm working on a upload script and using move_uploaded_file() function. The problem is, that
So I'm working on a script that's going to upload a video to a
I am working on an image upload site. When the user uploads the images
Recently I've been working on a Greasemonkey script that would add an image to
I am working on a PHP upload script which allows uploading only PDF files.
I'm currently working on an AJAX file upload script, which works like a charm
I am working on an image upload script and ran into this problem. Using
I'm currently working on a upload script supporting larger uploads (~50 Mb) and I

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.