1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to make image uploads fast

Discussion in 'Programming' started by HRA, May 20, 2015.

  1. #1
    Hi,

    I have a classified website based on Wordpress. It is highly customized.
    When people upload images along with their ad, its get watermarked, resized into different sizes (thumbnails, single ad page image etc).

    When I compared how much time it takes to upload an image with one of my competitors and some other global sites, I realized my site is VERY slow.
    Please take a look at this 40 seconds long video. It shows how much time it take to upload a 3.87mb image file to those other sites Im talking about.


    I have a 2mbps connection and it takes me more than 10 seconds to "download" that file using IDM. As you can in above video, it takes lot less longer to "upload" that file.
    I should remind that at the end, image is watermarked with different sized images too.

    So what is the secret? How to achieve this result? I don't have huge knowledge in these things. Just point me to some tutorials, guides, resources, anything. I would like to try.

    Thanks
     
    HRA, May 20, 2015 IP
  2. Anveto

    Anveto Well-Known Member

    Messages:
    697
    Likes Received:
    40
    Best Answers:
    19
    Trophy Points:
    195
    #2
    You would try to display the image as quickly as possible and store it I guess. Do all the processing in the background or server side while the user is filling out the form.

    Other considerations could be your host/provider and even hardware that it is running on.
     
    Anveto, May 20, 2015 IP
  3. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #3
    First, you should try to teach your clients / customers to not use 3-4MB pictures. You can pretty much achieve the same quality (this is for viewing on a screen, not print) with a 500kb jpg-image. So, tell your users to scale down their image before uploading.
    That being said, depending on how your internet connection is, what kind of hardware you're running the site on, etc., there might be a lot of different factors slowing down the site. First of, as @MarkusTenghamn said, you should do the upload, show the thumb for the picture, maybe, and just let the server handle the rest in the background - that shouldn't affect anything about how long the showing of the image will take for the customer.
     
    PoPSiCLe, May 20, 2015 IP
  4. HRA

    HRA Active Member

    Messages:
    314
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #4
    I placed a note about file size. It doesn't work. They are too lazy not to bother resizing. They just like to take the pic from camera or phone and just upload it as it is. Im afraid to put too much restrictions as it may frustrate users.

    My site is still a small one avg about 250 visitors. Its on DigitalOcean 10$ plan.
    Sites I show on that video are very big ones. Alexa rank less than 10000.

    From my home connection (2mbps) it takes max 10 seconds to upload 3.87mb image to those site. But on my site (even if it has low traffic) it takes few mins.

    Any idea how to do what MarkusTenghamn said.

    Thanks for replies.
     
    HRA, May 20, 2015 IP
  5. arpit13

    arpit13 Well-Known Member

    Messages:
    294
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    128
    Digital Goods:
    1
    #5
    I have noticed that php plugins like php imageworkshop are slower than writing your code. In my recent project, I used SimpleImage library for php and found that it slowed down uploads as compared to a code written by myself. So that might be your problem too.
     
    arpit13, May 24, 2015 IP
  6. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #6
    I'd say your hosting could be part of the problem -- they advertise 2gb throughput but is that symmetric? Just as a lot of ISP plans for home will give you 15 down and 1 up, a lot of web hosts will give you 10mpbs up but neuter your imcoming to a tenth that... It's why I don't trust any hosting plan that doesn't even list throughput.

    Which DigitalOcean clearly does not.

    Laugh is you should be able to get an unmetered VPS for that or less with far more cores and comparable memory -- I'd drop the $10 to $40 to try out a few other plans as a test just to see if you could get something better.

    Take the jokers I'm hosting with right now:
    http://afterburst.com/unmetered-vps

    Admittedly, the affordable VPS plans give you a vanilla install and SSH access, and EVERYTHING else is up to you to provide, but in doing so you can go far, FAR faster. Laugh is, their $10/mo VPS is faster than the dedicated $65/mo host I was paying for just five years ago.

    Really I'd suspect your hosting as the culprit here since as you are saying other sites are faster.
     
    deathshadow, May 24, 2015 IP
  7. HRA

    HRA Active Member

    Messages:
    314
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #7
    Thanks for the reply.
    Other sites Im referring to are very big traffic sites. Even then their uploads are faster so its possible that hosting plays a part on that.
    I was wondering if that's the only reason. I wanted to know if there is something I can do from a script.

    Thanks
     
    HRA, May 24, 2015 IP