Image Uploads Failing at 100%

3 posts by 2 authors in: Forums > CMS Builder
Last Post: November 3, 2011   (RSS)

By dennisoneil - November 2, 2011

Hello,

This may be a memory or process limit issue, but I was hoping to get some input.

I have 2 clients that have recently attempted to upload large images via CMSB. Both scenarios would involve the image being made into a couple thumbnails by CMSB.

An example file is 3504px Wide X 2336px tall JPG file @ 4.7MB.

My max upload is set at 100MB.

After selecting the file, the flash uploader begins and then gets all the way to 100%, where is stalls indefinitely. If you select multiple files for upload, it does not get past the first. I have attempted the same upload with the exact same results.

When I check the server via FTP, the original file is there, but it does not appear in the CMSB record, and none of the thumbnails have been created. I am assuming that the failure happens when an attempt to make the thumbnails begins, so the subsequent logging into CMSB db doesn't happen.

I recognize that a 4.7MB photo with those dimensions is large, but as I also know you're aware, users don't really care.

I have a Hybrid VPS server with 1 Xeon CPU core and 3GB of dedicated ram. My server stats provided by my host show occasional spikes, but nothing near my total capacity. It shows an average of 10% CPU utilization with occasional spike to 40% and rarely above 1/2GB of RAM usage.

Do you think this a server resource issue, or something with the conversion/resizing engine?

Thanks in advance for your help.

-Dennis

Re: [dennisoneil] Image Uploads Failing at 100%

By Jason - November 3, 2011

Hi Dennis,

We have seen this problem before. The issue here isn't the size of the file, but the dimensions of the image. Singe the height X width of the image is so large, the php function that re-sizes the image runs out of server memory and causes an error. The actual error is suppressed by CMS Builder due to an unrelated issue, which is why the upload appears to stall.

If you don't have the upload field creating thumbnails, the problem would go away.

The current work around for this is to attempt to increase the server's memory limit for scripts.

NOTE: Make a backup of your database and files prior to attempting any custom changes.

Open up cmsAdmin/lib/init.php you'll see a series of calls to ini_set() at the top of the file. At the end of this list you can add this line:
ini_set('memory_limit', '256M');

This increases the scripts memory limit from 128MB to 256MBs. That should allow you to upload and resize images of those dimensions. The upload may still be slow because of that size, but it should work. Please note that this is a custom fix, so if you upgrade your copy of CMS Builder, you'll need to put this line back in.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/