Jump to content

increase product image upload size


Recommended Posts

Hey -

 

This is my first post but certainly not a noob to Invision Power board forums. Did search extensively for an answer to my question but could not find anything.

 

When I attempt to upload an image to a product, the form says max file is 0.12MB. It certainly holds to that.

 

My php.ini file is set at 128mb so that's not an issue. I have changed the settings in Preferences -> Images -> Product Images and still the upload page says 0.12MB.

 

I have also set the Administration -> Preferences -> Upload Quota -> image value upload limit to 2mb and still, the upload page for a products says 0.12MB

 

What gives? I am using the default skin for 1.5.2. I upgraded from 1.4.9 using the auto upgrader.

 

Thanks for any thoughts or ideas.

 

Brian

 

[edit] okay, now it says max upload is 1.91 mb. strange why the delay?

Edited by surferboy (see edit history)
Link to comment
Share on other sites

  • 1 month later...

Found a manual solution:

 

Run that on your SQL:

 

UPDATE `your_db_name`.`ps_configuration` SET `value` = '2097152' WHERE `ps_configuration`.`id_configuration` =33;

 

This will change it to 2 Mb (raise or reduce as much as you want)

 

You should be able to change it under "Preferences -> Images", but for some reason its not saving it on the DB when you select Save.

  • Like 4
Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...

Same problem UNSOLVED here.

 

I've just upgraded to ps 1.6.0.9 and I have almost 5000 products. When I try to upload images the bigger ones report error.

 

So to test it I resize one of the images to half size.

 

So original size was: 3.22Mb and 3744 x 5616 pixels (got error in upload)

Half size 976kb and 1872 x 2808 pixels went fine

 

In backoffice I changed the preferences/images

 

Maximum size to 5000000 bytes

max weight and lenght to 5000 both (pixels)

 

I double checked the database and the values changed inside it so what's wrong???

Link to comment
Share on other sites

  On 1/6/2015 at 2:38 PM, jvicente said:

Same problem UNSOLVED here.

 

I've just upgraded to ps 1.6.0.9 and I have almost 5000 products. When I try to upload images the bigger ones report error.

 

So to test it I resize one of the images to half size.

 

So original size was: 3.22Mb and 3744 x 5616 pixels (got error in upload)

Half size 976kb and 1872 x 2808 pixels went fine

 

In backoffice I changed the preferences/images

 

Maximum size to 5000000 bytes

max weight and lenght to 5000 both (pixels)

 

I double checked the database and the values changed inside it so what's wrong???

 

check you php.ini value for upload_max_filesize  (edited as I had wrong field to check)

 

you can use my free module to check all php.ini and runtime 

http://www.prestashop.com/forums/topic/278164-free-module-display-php-environment-phpinfo-back-office/

Link to comment
Share on other sites

  On 1/6/2015 at 2:58 PM, El Patron said:

check you php.ini value for max_file_uploads

 

you can use my free module to check all php.ini and runtime 

http://www.prestashop.com/forums/topic/278164-free-module-display-php-environment-phpinfo-back-office/

Ok, but I upgraded from 1.5.6 to 1.6 and before the images were uploading fine....so, do you think it's a matter of php.ini configurations?

 

I installed your module and got this information:

max_execution_time 300

max_file_uploads 20

max_input_nesting_level 64

max_input_time 300

max_input_vars 10000

memory_limit 128M

Edited by jvicente (see edit history)
Link to comment
Share on other sites

  On 1/6/2015 at 4:41 PM, El Patron said:

earlier you mentioned an error message for the larger images, what is the exact message?

yess,

 

my message was:

 

""I've just upgraded to ps 1.6.0.9 and I have almost 5000 products. When I try to upload images the bigger ones report error.

 

So to test it I resize one of the images to half size.

 

So original size was: 3.22Mb and 3744 x 5616 pixels (got error in upload)

Half size 976kb and 1872 x 2808 pixels went fine

 

In backoffice I changed the preferences/images

 

Maximum size to 5000000 bytes

max weight and lenght to 5000 both (pixels)

 

I double checked the database and the values changed inside it so what's wrong???""

Link to comment
Share on other sites

no the exact error message, so I can isolate the code issuing the error message.

 

what I noticed in the code is that it will use the smallest value from post_max_size or upload_max_filesize

 

check that post_max_size is larger than image size

 

from classes/Tool.php

	public static function getMaxUploadSize($max_size = 0)
	{
		$post_max_size = Tools::convertBytes(ini_get('post_max_size'));
		$upload_max_filesize = Tools::convertBytes(ini_get('upload_max_filesize'));
		if ($max_size > 0)
			$result = min($post_max_size, $upload_max_filesize, $max_size);
		else
			$result = min($post_max_size, $upload_max_filesize);
		return $result;
	}
Link to comment
Share on other sites

  On 1/6/2015 at 6:04 PM, El Patron said:

 

no the exact error message, so I can isolate the code issuing the error message.

 

what I noticed in the code is that it will use the smallest value from post_max_size or upload_max_filesize

 

check that post_max_size is larger than image size

 

from classes/Tool.php

	public static function getMaxUploadSize($max_size = 0)
	{
		$post_max_size = Tools::convertBytes(ini_get('post_max_size'));
		$upload_max_filesize = Tools::convertBytes(ini_get('upload_max_filesize'));
		if ($max_size > 0)
			$result = min($post_max_size, $upload_max_filesize, $max_size);
		else
			$result = min($post_max_size, $upload_max_filesize);
		return $result;
	}

About post_max_size or upload_max_filesize they are both above filesize. I tried to upload the big file again and the error was:

 

7320.jpg : An error occurred while copying image, check your memory limit.

  • Haha 1
Link to comment
Share on other sites

try memory of 256mb.

 

here is where error comes from, during resize

	public static function checkImageMemoryLimit($image)
	{
		$infos = @getimagesize($image);

		$memory_limit = Tools::getMemoryLimit();
		// memory_limit == -1 => unlimited memory
		if (function_exists('memory_get_usage') && (int)$memory_limit != -1)
		{
			$current_memory = memory_get_usage();
			$channel = isset($infos['channels']) ? ($infos['channels'] / 8) : 1;

			// Evaluate the memory required to resize the image: if it's too much, you can't resize it.
			if (($infos[0] * $infos[1] * $infos['bits'] * $channel + pow(2, 16)) * 1.8 + $current_memory > $memory_limit - 1024 * 1024)
				return false;
		}
Link to comment
Share on other sites

  • 1 month later...
  • 2 years later...
  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...