Jump to content

Image resizing with not enough php memory


c_shelswell

Recommended Posts

Hi

 

I've got a script to resize images that a user uploads. This all works fine but I've come across a problem with it on another server. If the user uploads pictures over a certain pixel size i get a 500 internal server error which i've found is caused by php not having enough memory.

 

Does anyone know of a way to get round this? Can I temporarily set the php memory from a script? I don't think i can use a htaccess file.

 

Any ideas would be great.

 

Cheers

You can change the upload limit in PHP.INI.  if you dont have access, ask your host.  Sometimes they allow the use of a PHP.INI file in the directory where the script runs, to override the global default value.

 

Or perhaps a bit of javascript which checks the filesize before submission.

Hi thanks for your replies. I've tried using set_time_limit(0) in the script doing the resizing, to no avail. It works on a different server where the memory is set to 24mb this server is 20mb.

 

I don't have access to the .ini file unfortunately and the provider won't turn it up.

 

I'm going to give this a go : "ini_set("memory_limit", "16MB");" cheers samshel. I take it I just add that at the top of my script?

 

Cheers

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.