Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i have a lamp server which runs php script. i use this script which automatically uploads and resize the image to the defined resolution.

i have a problem now. a 5Mb file takes about 6 seconds to finish the full job. if i queue up 10 files for upload the server is not responding for other requests. and the both cores of the processor are at 100% use.

i have the full access to the server. what should i do to reduce the work load of the server. is the problem on the scripts or should i use any pluggins for resizing..

share|improve this question
I think this has much better chances to be answered at stackoverflow or serverfault – Sergey Sep 9 '11 at 11:16
up vote 1 down vote accepted

The PHP file you linked uses the imagecopyresampled function, which needs much cpu to do the work. You can use the function imagecopyresized instead, but the resulting quality will be worse then.

Depending on the destination size, you can combine these two, first reduce the pictures size by imagecopyresized half of its size, and use then imagecopyresampled to reduce the size to its final size. This should end in a similar quality as if you would have done it in one step using imagecopyresampled

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.