We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Reducing filesize locally before upload?

Medium Priority
254 Views
Last Modified: 2013-12-25
Is it possible to reduce a file size of an image BEFORE its uploaded to my server.
My php uploads have a limit of 2mb I could just increase it but I have about 100 uploads of some quite large images a day onto my site and would like to know if its possible to reduce this locally before it uploads?

My alternative would be asking the visitors to keep the size down before uploading, but  some users dont even know what 2mb means. The easier I can make it the better but at the same time I dont want huge files eating at my bandwidth which is what is happening at the moment!

I know there is imagemagick which is what I am currently using to resize and create thumbnails but I want the original file compressed before upload.

Is this possible?
Comment
Watch Question

Yes, your users can download and install some image manipulating software like GIMP and edit their images (e.g. scale down or reduce jpeg quality) until the size requirements are met.
CERTIFIED EXPERT
Expert of the Year 2008
Top Expert 2008
Commented:
>>Is it possible to reduce a file size of an image BEFORE its uploaded to my server.
No, YOU can't do this. PHP runs on YOUR server. You don't have access to the user's file system. Your only options are:
a. ask user to resize their files
b. increase the upload limit.

>>I could just increase it but I have about 100 uploads of some quite large images a day onto my site
OK, but if you want small images to begin with, you an increase the upload limit and resize the images yourself once uploaded.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
You can change the 2mb limit by configuring the server "php.ini"
post_max_size=16m
upload_max_filesize=16m

or if you dont have access to the php.ini in the server you can make these changes in  ".htaccess" file

php_value post_max_size 16 MB
php_value upload_max_filesize 16 MB
php_value max_execution_time 60

I Hope this help you.
Other solution is that you give those users ftp access....

Author

Commented:
Thanks I did think that but wasnt sure if I was missing something somewhere
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.