I understand there are ways to upload multiple images from browser to server and also the uploading speed is base upon the speed of the server and network. The standard way of doing it:
Click a upload button in the website -> choose what images you want to upload -> click Submit Button to upload all the images to the server (Prompt "please wait" to user) -> Upload Successful!
But in terms of the coding part, I was just wondering is there a faster way to efficentily upload images from client's device to server? (Using Javascript and php)
Currently what I am doing is first "cut-down" the images in client side first, then send the images back to server. But this is very slow since javascript takes time to "cut-down" the size of the images. By "cut-down", I mean to make the image width and height smaller. Is there a faster way to do it?
(Some javascript and php coding example would help as well.)
Add fingerprints to image URLs on upload to take advantage of less cautious image caching settings. Always upload images with the right format. Lower your image quality standards on upload to reduce bandwidth.
Low server resources or unusual traffic might also cause this error. As a result, waiting a few minutes before attempting to re-upload the image is always a good idea. If the problem persists, you may have reached the WordPress memory limit. You can increase the amount of memory by connecting your site using FTP.
Short Answer: No, Javascript is not slow, neither PHP.
If the image is big (some megabytes), it will take a moment to crop/resize the image in javascript/php. There is no way to avoid it.
I believe you're having a performance issue because:
Consider optimizing images before uploading them. I suggest you use kraken.io, which you can reduce the size of the images without changing image quality (loseless mode).
Also, consider uploading images by chunks, which:
There are many chunk upload plugins, here is one of them:
https://github.com/blueimp/jQuery-File-Upload/wiki/Chunked-file-uploads
Last but not least, look at kraken.io itself, maybe you learn few things on how to speed up image uploading.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With