Jump to content

Allowing customers to upload larger 'customization" images


Recommended Posts

I've enabled Product Customization in my shop where a customer uploads an image to customize the product. As it operates now, any image over about 1,000KB just brings them back to the product page without performing the upload.

 

I've tried changing the "Maximum size of product pictures:" in "Back Office > Preferences > Products" to a very large size to no effect.

 

Don't know where to affect it. Database? Code?

 

And while on the subject, the uploader seems to downsample the image's bit depth automatically. Any way to have the uploader not alter the image at all when it saves it to server?

 

I'm using Prestashop 1.4.2.5

 

Any help is appreciated.

 

Dan

Link to comment
Share on other sites

Hi,

Try to set

ini_set('upload_max_filesize', '100M');

in config/config.inc.php

 

Thanks,

Jeevan

 

Jeevan,

 

Thanks for the help, but it doesn't seem to affect anything. Here's a log that I created of changing that value in config.inc.php and the result from Prestashop:

 

------------------------------------------------------------------------------------------------

Image is too large (1106.005KB). Maximum allowed: 10KB */ini_set('upload_max_filesize', '1M');

Image is too large (1912.657KB). Maximum allowed: 10KB */ini_set('upload_max_filesize', '1M');

Image is too large (701.968KB). Maximum allowed: 10KB */ini_set('upload_max_filesize', '1M');

2049K and larger just brings me back. */ini_set('upload_max_filesize', '1M');

 

Image is too large (1018.727KB). Maximum allowed: 10KB */ini_set('upload_max_filesize', '10M');

Image is too large (51.162KB). Maximum allowed: 10KB */ini_set('upload_max_filesize', '10M');

2049K and larger just brings me back. */ini_set('upload_max_filesize', '10M');

 

Image is too large (1106.005KB). Maximum allowed: 10KB */ini_set('upload_max_filesize', '100M');

Image is too large (80.787KB). Maximum allowed: 10KB */ini_set('upload_max_filesize', '100M');

2049K and larger just brings me back. */ini_set('upload_max_filesize', '100M');

 

Image is too large (953.183KB). Maximum allowed: 10KB */ini_set('upload_max_filesize', '1000M');

2049K and larger just brings me back. */ini_set('upload_max_filesize', '1000M');

 

Image is too large (1018.727KB). Maximum allowed: 10KB */ini_set('upload_max_filesize', '10000M');

2049K and larger just brings me back. */ini_set('upload_max_filesize', '10000M');

 

...

 

Image is too large (765.152KB). Maximum allowed: 10KB */ini_set('upload_max_filesize', '1000000000M');

2049K and larger just brings me back. */ini_set('upload_max_filesize', '1000000000M');

---------------------------------------------------------------------------------------------------------

 

It wasn't until I changed the "Maximum Size of Product Pictures" variable in the admin panel to 999999999 that it started liking and uplodaing images UP TO that 2MB file size again. I'm concerned about Prestashop not dealing with the images over 2MB. It's like the code doesn't like the large file size and stops running. It simply goes back to the product page with no notifications.

 

This is essential to my shop. I'm concerned that if I can't get it to accept any graphic and not alter it, I may need to start over with a different solution.

 

Any help from anyone is appreciated.

 

Dan

Link to comment
Share on other sites

I got it, it looks correct.

 

I'm not sure what else is could be, you can try to report it in the bug tracker, and get help for a team member.

 

The other option is to add debug code and try to figure out where the lower limit is being set.

 

You can look at any reference to the function checkImage(), as the limit is passed to it.

 

You can also edit /images.inc.php and comment out the size restriction

 

//if ($file['size'] > $maxFileSize)
//		return Tools::displayError('Image is too large').' ('.($file['size'] / 1000).Tools::displayError('KB').'). '.Tools::displayError('Maximum allowed:').' '.($maxFileSize / 1000).Tools::displayError('KB');

Link to comment
Share on other sites

Well, I'm a little closer to pinpointing the issue:

 

It seems the filesize isn't the issue. It's the number of pixels. If the total number of pixels (width*height) > 5,893,475 then it stops loading the page after upload.

 

Although I got it to fail with one exception to that rule: it worked with an image 30,000px x 166px (=4,980,000) but didn't with an image 166px x 30,000px.

 

I'm going to keep trying things with images.inc.php, but if someone knows something to try specifically, please let me know.

 

Thanks,

Dan

Link to comment
Share on other sites

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

i have same problem, i tryed  max uploaded size, htaccess etc. but nothing 

 

i found line where is PROBLEM !!!! 

 
"........  admin/ajaxfilemanager/inc/config.base.php"
 
 
73.line  //UPLOAD OPTIONS CONFIG
74.line  define('CONFIG_UPLOAD_MAXSIZE', 5000 * 1024 ); //by bytes
 
this line get me max uploaded file size was around 4,9 MB what problem when i tryed upload video 42,5 MB ... i changed 5000 to 50000 and HEUREEEEKAA !!!!! all its ok .. i hope help you !
Link to comment
Share on other sites

 

i have same problem, i tryed  max uploaded size, htaccess etc. but nothing 

 

i found line where is PROBLEM !!!! 

 
"........  admin/ajaxfilemanager/inc/config.base.php"
 
 
73.line  //UPLOAD OPTIONS CONFIG
74.line  define('CONFIG_UPLOAD_MAXSIZE', 5000 * 1024 ); //by bytes
 
this line get me max uploaded file size was around 4,9 MB what problem when i tryed upload video 42,5 MB ... i changed 5000 to 50000 and HEUREEEEKAA !!!!! all its ok .. i hope help you !

 

 

please see  back office configuration

 

12.12.2014-07.05.png

http://screencast.com/t/6PeqaLRiQr8

Link to comment
Share on other sites

  • 4 months later...

However now when I try to upload a 20M file it all falls over as I exceed my 128M server memory limit.  This happens at line 429 in ImageManager.php  

 

   return imagecreatefromjpeg($filename);

 

I does seem odd that a 20M upload will use the memory limit - but I don't know too much about the internals.

 

Will increasing my memory limit on the server solve the problem or has something gone berzerk?

 

Thanks,  Andrew

Link to comment
Share on other sites

  • 3 months later...

Hi All,  this forum topic seems the closest thing to an issue I'm having with images uploaded within Product Customization shrinking in size once uploaded. But I have checked all the settings & preferences within the back office, and checked the php ini.file settings (thanks to El Patron's free module) but no joy! I'm having some difficulty in finding the answer to this problem. I need customers to upload image files for their personalised items, and this function seems to work well in front office, with images uploading & the preview bring shown. They show at checkout and the customer can complete their order. The images also show up in the preview section of the order in the back office, but when clicked on to download the files have been shrunk from 1 or 2mb to just 4 or 5kb..?? If I look in the "upload" folder via FTP there shows 2 files for each image uploaded, with one having the prefix of "small" added, but both files are the same size at 4 or 5kb. One image I guess is supposed to be "small" for the preview, but why is the other not the full size uploaded image?

 

Any help much apppreciated. I have looked through the forum and can't find anyone who has had a similar problem. I'm using the default bootstrap theme in 1.6.0.14.

 

Hoping it is a minor tweak to some code somewhere, or a module that needs re-setting...

 

Thanks in advance to any forthcoming help.

 

Cheers, Matt.

Link to comment
Share on other sites

Quick update on my post above :

 

I think I've worked out what has happened, I made an edit to the code somewhere(?) to change the size of the image preview when an image is uploaded within product customization. I remember changing the size and now think I changed it twice by accident, which is why both the image preview & the uploaded image are the same size.

 

Could someone please tell me which folder/file alters the Image Preview size? It would be much appreciated as I've looked everywhere and can't find the code.

 

Thanks, Matt.

Link to comment
Share on other sites

  • 2 weeks later...

In the end I have upgraded Prestashop to the latest version 1.6.1.1 and the problem has now dissapeared, GREAT... but now have new issue... I hope someone can help? I'm using the default theme.

 

Customers can't upload images greater than 1.6mb through the Product Customization field?  I have 3 fields for uploading images, and if you upload 3 images all at once at 1.5mb they will upload and show as previews (also on server in "upload" directory).

 

Thanks to El Patrons ini.file module (FREE) I've checked server specs and all seems well above 20mb upload. The preferences within Back Office are also above 10mb (Preferences>Images   & Admin>Preferences) so don't know what else it can be.

 

I have error reporting on, and nothing shows as a debug error. An error does come up within the web page (part of the theme) :

 

There is 1 error

  1. An error occurred during the image upload process.

 

If I upload an image as attachment through the "Contact Us" page then the size is slightly bigger at 1.9mb, but anything bigger doesn't appear with the message in the Back Office, and no error message shows.

 

Please if anyone has any suggestions to fix this it would be much appreciated.  Thanks, Matt.

Link to comment
Share on other sites

  • 5 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...