Excerpt: The other day I was on the look out for a solution to speed up the process of uploading images on the server.
We had the code in place already, and everything was running smooth (resizing, thumbnail creation), but there was just one problem when the user will upload something over 1024 x 800.
It was taking too long and the user will either get a server error, or just run out of patients, cancelling the upload or just close the browser.
Dealing with users that have no knowledge of adjusting the digital camera to take o lower quality / size picture, or just they don't want to or..., made me think.
I needed a solution that will not break apart in the middle of doing its job, will be fast and doesn't require too much of my time.
So looking at what I have.
1. 1 x products table
2. 1 x product images table, related to the products table by product id
3. 1 x folder that stores the images
So the solution I came up with was:
1. Duplicate product images table and add an extra field (status, 1=done, 0 = to be processed)
2. Create a new folder to store the temporary images
3. When the user uploads an image, we store the details into the duplicated table, and upload the image into the temporary folder without doing any work on them.
4. Create a new page that will look into the duplicated table, gets all the records where the status=0, then using while... statement, the following work was carried out:
a. get the record details, store them into
...
read more »
...