user2565 จาก ไม่รู้จัก เป็นสมาชิกตั้งแต่ ธ.ค. -0001 user2565 13 ม.ค. 2016 00:38 Hi all Posting in the hope that this will help someone to get round the issue (or maybe help to bugfix). 1) PNGs > JPGs On my shared host and with the latest version of Litecart I have 128mb memory according to phpinfo(), and have tried PHPs 5.2-5.5 without any change in behaviour from below (other than PHP 5.2 only gave me 500 errors back). When uploading a JPG product image of more than about 227kb (that's as much as I have managed), I get the following error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 40144897 bytes) in /home/cluster-sites/4/u/site_here/public_html/includes/controllers/ctrl_image.inc.php on line 22 (occasionally this references line 20, or line 7xx in the same file which refers to whitespace following 'case jpg/jpeg'). Oddly, I can upload bigger PNGs with far fewer problems, just tested a 3.1mb PNG. Is it possible they take less memory to process? Or is this something to do with the JPG code? 2) There still seems to be a size limit Either way it won't do a 5.2mb PNG, so there must be some limit being reached -- which I guess is a secondary issue. It may sound daft to want to upload an image of that size but my client doesn't want to have to batch convert the images before uploading them, citing the fact that other systems will handle big images (although his example is eBay). I don't want to move away from Litecart either, so I was wondering if anyone had any ideas. All the other support I have read around this topic seems to fix things when memory available gets to the 128MB+ mark. UPDATE Just an update on this. I've had my host increase the memory available to 512mb, confirmed with phpinfo() in the web root. However I still get the same error, albeit with a slightly different allocated memory: Fatal error: Out of memory (allocated 118226944) (tried to allocate 40144897 bytes) in /home/cluster-sites/4/u/site_here/public_html/includes/controllers/ctrl_image.inc.php on line 22 1) Is it possible that there is a memory limit being imposed by Litecart? 2) I'm no programmer, but is there a way to do whatever transformations the system is trying to perform in a more memory-efficient way than the libraries in use might be using?
tim Founder จาก Sweden เป็นสมาชิกตั้งแต่ พ.ค. 2013 tim 14 ม.ค. 2016 17:16 A search for ini_set('memory_limit' leaves no results. LiteCart does not set memory_limit. This is a common error by the GD2 PHP extension which consumes a lot of RAM when resampling extremely high resolution images. Later versions of LiteCart have support for the PHP extension Imagick (see ctrl_image.inc.php). I've been told GD2 is not ass buggy as Imagick in general. Uploading hi-res images rather than extremelyhi-res is one solution.
user2565 จาก ไม่รู้จัก เป็นสมาชิกตั้งแต่ ธ.ค. -0001 user2565 14 ม.ค. 2016 23:16 Thanks TiM, much appreciate the reply. I am using 1.3.3.1 so didn't really think LiteCart was the issue. Do you happen to know if the GD2 error persists in the most recent versions? I'll see if my host can help further although I think they will say no to updating the library for the whole server (this particular site is on shared hosting). I tried commenting out the following from ctrl_image.inc.php in an attempt to force imagick to load (although I think the order of the logic would load imagick preferentially anyway): } else if (extension_loaded('gd')) { $this->_library = 'gd'; No dice, I get the "no image library available" error. Back to the host I guess... Just to check -- I'm looking at a 3mb JPG -- that would be hi-res rather than extremely hi-res, wouldn't it?
tim Founder จาก Sweden เป็นสมาชิกตั้งแต่ พ.ค. 2013 tim 15 ม.ค. 2016 23:00 Then Imagick is not supported on your host. 3 MB and the compression level doesn't tell anything about the RAM needed for resampling, it's the actual pixel resolution that is crucual. http://www.dotsamazing.com/en/labs/phpmemorylimit Other than that there could be a memory leak bug your current the php/gd version. Trying a different PHP version would show a difference in such case. If you need to batch resample a folder full of images before uploading you can use Irfan View's batch conversion.
user2565 จาก ไม่รู้จัก เป็นสมาชิกตั้งแต่ ธ.ค. -0001 user2565 17 ม.ค. 2016 23:32 Thanks again TiM! I tried PHP 5.2-5.5 before without any more desirable behaviour. Waiting on the hosting provider to see if they can add Imagick as a PHP module, not just the 'convert' binary, if no joy there then it looks like my client is going to have to resize their own images! Will report back if I make any progress. Thanks again for your time.
tim Founder จาก Sweden เป็นสมาชิกตั้งแต่ พ.ค. 2013 tim 17 ม.ค. 2016 23:40 LiteCart doesn't roll with PHP 5.2 or lower. 5.3+ is required. What are the dimensions of the uploaded images?
gimenez70 Developer จาก Argentina เป็นสมาชิกตั้งแต่ เม.ย. 2019 gimenez70 1 พ.ค. 2019 22:23 I had this problem with that error of the image control file, I solved them by changing the size of the images to less than 300 kb and image width 600px