PDA

View Full Version : PHP settings limit the maximum file size per upload to 2 MB.



matizaaa
12-02-2009, 12:59 PM
HI,
I recently installed drupal and i'm trying to upload some images, I'd like them to be high quality so would like them to be larger than 2m some of the files i have are 12-13 megabytes.

I was wondering if you guys have any idea on how I can fix this error.

The error i get from drupal is

Your PHP settings limit the maximum file size per upload to 2 MB.
Depending on your sever environment, these settings may be changed in the system-wide php.ini file, a php.ini file in your Drupal root directory, in your Drupal site's settings.php file, or in the .htaccess file in your Drupal root directory.

I already went to php.ini change the upload_max_filesize = 16M, but that didn't work.

It doesn't seem like there are any values to be edited in the settings.php or the.thaccess files.

If you guys want i can post my php.ini file up here.

Also i read somewhere that i need to have the php.ini file in every folder. When i search for it i only find php.ini on the public html folder.

felgall
12-02-2009, 01:20 PM
Upload your images using FTP. The PHP upload option is only there for your visitors to upload files and there is no reason why you should be using it.

Anyway 2Mb is many times too big for an image to be used on the web. You shoud compress the images down to about 40k or less each if you intend using them in web pages.

matizaaa
12-02-2009, 01:34 PM
Felgall, thank you very much for your response and your kind advice, but that does not really answer my question. Also ftp doesn't create the thumbnails and previews and other things.

By any chance do you know how i can increase this value? or can you give me a lead to follow?

felgall
12-02-2009, 05:55 PM
Why are you working with such humongous images anyway. Unless your computer monitor dimensions are measured in miles rather than inches you shouldn't need images anywhere near that big.

Also image processing is very CPU intensive and so creating thumbnails on the server is not recommended. You are better off generating the images at the appropriate sizes before you upload them.

felgall
12-02-2009, 10:34 PM
Just remember that for some of your visitors a 2Mb image will take an hour or more for them to download. Even most of those on fast internet connections will not wait for an image that ig to load since even with a fast connection it will take several times as long as people are prepared to wait for an entire web page to load.

Generally any huge files that you upload should be compressed archives such as zip files that you are offering for people to download where you can provide some form of warning about the file size before people try to access it so that they will know whether it is going to take five minutes or five days to download based on their own knowledge of their connection speed.

felgall
12-03-2009, 11:09 AM
10 seconds to download at a connection speed where people expect pages to load instantly is an eternity. At that connection speed most people are gone if the page hasn't finished loading by two seconds. Also that 10 seconds is the optimal speed with maximum bandwidth and nothing else running. In the real world it is likely to take 10 times as long.

Anyway, how many miles across do you expect your visitors screens to be in order to need such huge images? A 100k image looks quite acceptable at full screen at the highest screen resolutions most people are likely to be able to use.

No one needs images over 100k in size for web use as the rest of the information in bigger images is wasted space as it will not be seen on the screen at all.

The only time you need larger images than that is for printing or downloading and for this you are better off zipping the images before you upload them so they don't take so long to be downloaded.

Have you actually tried optimising the images for the web before you upload them? In most cases a 2Mb image would shrink to about 50k (or less) when properly optimised for the web.

drewbert
12-07-2009, 01:33 AM
Not all image files on the internet are intended for display on screen. Just sayin' :)

felgall
12-07-2009, 11:01 AM
All images on web pages are intended for display on the screen. Where an image is not intended for display on the screen it ought to be included in a zip file to make downloading it easier.

The terms of use of BlueHost web hosting is that it can only be used for web hosting and not for any other purpose.

The situations where you would need to upload an image file bigger than 100k without it being inside a zip file are therefore just about nonexistant.

altoman
12-22-2009, 05:30 PM
Often large files (2mb+) are uploaded by users of digital cameras such as a photo gallery or classifed ad directories. Then the server side script reduces those files such that they can be viewed on a typical monitor. I hope this clarifies the potential reason of uploading large image files AND how they are handled server side.

felgall
12-22-2009, 07:00 PM
Then the server side script reduces those files such that they can be viewed on a typical monitor.

It is to help to educate newbies so that they don't keep making that mistake that I have been making the posts on this thread.

Server side scripts for resizing images use huge amounts of CPU making them inappropriate for use on shared hosting.

Before BlueHost implemented CPU throttling the most common reason for exceeding CPU limits was running scripts to resize images. Now it just makes their site run dead slow.

If you are going to use shared hosting for your photos instead of a dedicated server then you should resize the images before you upload them.

In fact since the images will never be viewed online at the sort of resolution that even a low res camera saves the image at only a web newbie would ever consider uploading the images direct from their camera instead of optimising them for the web first. Uploading images directly from a camera just shows ignorance of how the web works and while newbies often make that mistake at the start no one who understands how the web works would do that.

alemcherry
12-23-2009, 04:36 AM
All images on web pages are intended for display on the screen. Where an image is not intended for display on the screen it ought to be included in a zip file to make downloading it easier.

The terms of use of BlueHost web hosting is that it can only be used for web hosting and not for any other purpose.

The situations where you would need to upload an image file bigger than 100k without it being inside a zip file are therefore just about nonexistant.

There could be exceptions. For eg, users may want to download a higher resolution picture for printing, especially for commercial purpose. I guess a site that display images and allow higher version to be downloaded is well within the limit of BH t&C.

Compressing a JPG will hardly save anything.

Having said that, uploading images directly from DIgital Camera is totally noobish and a waste of resources. Your efforts to educate such users is welcomed :)

felgall
12-23-2009, 12:05 PM
There could be exceptions. For eg, users may want to download a higher resolution picture for printing, especially for commercial purpose. I guess a site that display images and allow higher version to be downloaded is well within the limit of BH t&C.

Certainly, I never said that there weren't exceptions - such images suitable for printing would still be well under 2Mb though unless they were for printing a full sized poster or similar.


Compressing a JPG will hardly save anything.

That's only true if you are maintaining the same overall image size and resolution as the original. Reducing from the thousands of pixels across the image to the couple of hundred needed to display it in a web page can make a huge difference. You can also compress most jpgs by around 60-80% without dramatically affecting their appearance on a web page. Between those two you can change your web page from taking several minutes to load to loading in a couple of seconds.

In fact there are additional benefits to compressing jpgs as far as possible before uploading them to the web in that the more you compress it the less likely it is to be stolen.