SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,764
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Limiting File-Size for Uploads?

    My website allows a user to upload a photo of him/herself, which will in turn be converted to a thumbnail that will appear as a Profile Picture/Thumbnail.

    Currently my script requires that uploads be no larger than 150 Kb.

    Is that a problem in anyone's eyes?

    Since my PHP uses GD to convert the uploaded image into a thumbnail, and since my code deletes the original uploaded file after it has been converted to a thumbnail, I suppose allowing larger file-sizes would be okay. And yet, I think 150 Kb is sufficient.

    Comments?

    Thanks,


    Debbie

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,177
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    The average user won't know how to reduce the image to 150kb, so most will be locked out by this restriction.

  3. #3
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,764
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    The average user won't know how to reduce the image to 150kb, so most will be locked out by this restriction.
    So what is a more reasonable upper file size?

    (I believe some of the PHP code I am using might not work for file sizes over 2MB or was it 2GB?!)


    Debbie

  4. #4
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,764
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    The average user won't know how to reduce the image to 150kb, so most will be locked out by this restriction.
    Ummm... SitePoint's limit is a measly 64Kb, so while the double-standard for me?!


    Debbie

  5. #5
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,177
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    Where do you get that limit from? I regularly take screen shots and post them here, and they are often around 250-500kb. I would prolly allow around 1mb ... as long as the backend can reduce that, of course.

  6. #6
    Non-Member
    Join Date
    Feb 2013
    Location
    Dallas
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    The average user won't know how to reduce the image to 150kb, so most will be locked out by this restriction.
    Is there any method to reduce the file size by coding or we have to do it manually?

  7. #7
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,177
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by ancy View Post
    Is there any method to reduce the file size by coding or we have to do it manually?
    It's done automatically via PHP, once you've told PHP what to do.

  8. #8
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,764
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    Where do you get that limit from? I regularly take screen shots and post them here, and they are often around 250-500kb.
    If you click on "My SitePoint", and then click on "Edit Avatar" you see...
    Note: The maximum size of your custom image is 75 by 75 pixels or 8.0 KB (whichever is smaller).

    If you click on "My SitePoint", and then click on "Edit Profile Picture" you see...
    Note: The maximum size of your custom image is 160 by 100 pixels or 64.0 KB (whichever is smaller).


    Quote Originally Posted by ralph.m View Post
    I would prolly allow around 1mb ... as long as the backend can reduce that, of course.
    Looks like I'll have to crack open the PHP Manual, and scutenize my code and functions again, and make sure none break at certain sizes. (I think they are all good under 2MB.)

    Anyone else have thoughts or practical experience with this topic?

    (Being a Mac user, and considering that I can resize photos for *free* on OS X, I guess I didn't think it was such a big deal if someone has to resize a photo so it is < 150Kb?!)

    Sincerely,


    Debbie

  9. #9
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,764
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Okay, Ralph, I changed my script to allow up to 2MB Photo uploads!!

    It works okay, although I have a lot of Question about Memory Limit in php.ini.

    Thanks,


    Debbie


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •