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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:08:15+00:00 2026-06-07T14:08:15+00:00

I am handling a uploading image file using PHP, then using ImageMagick to create

  • 0

I am handling a uploading image file using PHP, then using ImageMagick to create a thumbnail of the image.

Problem: How should I provide Imagemagick with the path of the source and destination file?

I gave the location of the source file as $_FILES['photo']['tmp_name']; which turns out to be something like

/tmp/php2c3dCg

For the destination file, I had to provide the full path like

/home/mywebsite/public_html/public/img/posts/thumbnail/1087_1174cc2995db2a19472da1bbf1665e94b5121246.jpg

Question

  1. Do I have to give the full path to the destination image? In the examples on Imagemagick website, it used convert dragon.gif -resize 64x64 resize_dragon.gif. When I tried convert /tmp/php2c3dCg -thumbnail 220x220^ -gravity center -extent 220x220 -quality 90 /home/mywebsite/public_html/public/img/posts/thumbnail/1087.jpg it seemed to work. How can I shorten it?

  2. Is /tmp/php2c3dCg located at the root and not in public_html? I dont see the folder in public_html.

  • 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-07T14:08:17+00:00Added an answer on June 7, 2026 at 2:08 pm

    1.

    You can use paths relative to the working directory. If you are using PHP’s exec(), the working directory is the directory containing the PHP script. But what’s wrong with absolute paths, your script doesn’t care if they are long and it’s one less source of problems.

    2.

    Yes, it is in the system’s temp directory. This is where PHP puts user uploaded files. They are deleted after the request is processed, so you need to copy/process it and save it somewhere else, if you want to keep it.

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

Sidebar

Related Questions

I have been using a jquery plugin called uploadify for handling file uploads as
Okay I have a small app for uploading an image (using phonegap, Jquery). I
I'm using paperclip for uploading files, handling images is easy, but how can I
Error Handling with files in PHP $path = '/home/test/files/test.csv'; fopen($path, 'w') Here I want
I am using express v2.5.8. I am uploading a file from a multipart form
Exception Handling in java based we services JAX-WS. I want to create user defined
Possible Duplicate: Handling InterruptedException in Java I wonder how InterruptedException should be properly handled.
How should I be handling, or rather NOT handling (ignoring), touches to my background
Why might a file only be partially uploaded? I am improving error-handling in my
I am uploading large files to an ASP.NET server using a standard HTML <input>

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.