antuan Posted March 19, 2009 Share Posted March 19, 2009 Hello and sorry form my english.Searching a metod for clean the white spaces for the images i probe this and run ok. In admin/functions.php change arround the line 197 change the simbol > for <.The crop images dont show withe spaces (crop outside) and generate a proportional images fill all the type images (small, large, etc...) (crop inside)I probe in V1.0.Original: if (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 2 OR (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 0 AND $widthDiff > $heightDiff)) Modified: if (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 2 OR (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 0 AND $widthDiff < $heightDiff)) Sorry sorry for my english. (im spanish) Link to comment Share on other sites More sharing options...
coalesce Posted December 4, 2009 Share Posted December 4, 2009 Please note I found this code in the images.inc.php file. Thanks for the fix! I did a small test and it looks like it worked! Link to comment Share on other sites More sharing options...
coalesce Posted December 6, 2009 Share Posted December 6, 2009 Wanted to follow up. I'm using Prestashop 1.2.5.0, while the fix worked for the image resizing, when I went back and clicked on "catalog" in the admin area it failed to list products. This hack will break product management functionality in the backend this way... Will see if I can figure out a way around it as it was resizing images properly... Antuan any ideas? Link to comment Share on other sites More sharing options...
coalesce Posted December 6, 2009 Share Posted December 6, 2009 Very strange, changed: if (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 2 OR (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 0 AND $widthDiff > $heightDiff)) to: if (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 2 OR (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 0 AND $heightDiff > $widthDiff)) and it now seems to be working... Hope this helps anyone having similar issues 1 Link to comment Share on other sites More sharing options...
eGzyl.pl Posted February 5, 2010 Share Posted February 5, 2010 i have V1.1 and dont have line 129 in admin/function.phpwhere i find it? Link to comment Share on other sites More sharing options...
RooTX Posted May 8, 2010 Share Posted May 8, 2010 The trick is working with 1.3 RC4 too.As of 1.3, the line You are looking for is around 136 in /images.inc.php; Link to comment Share on other sites More sharing options...
Liberalis Posted May 12, 2010 Share Posted May 12, 2010 Hello, could anyone give me a hint on how exactly this works ?I'm under v1.2.5 and changed the line in images.inc.php file.When I regenerate the pictures, the white space is still there as if it had no impact.Any help would be much appreciated.I'm desperately trying to find a solution for the product image background to not have white stripes around the cropped image. Link to comment Share on other sites More sharing options...
sm3004 Posted October 5, 2010 Share Posted October 5, 2010 Great trick for image cropping, no more whitespaces with Presta 1.3.1.1. Link to comment Share on other sites More sharing options...
airelibre Posted October 26, 2010 Share Posted October 26, 2010 Thanks, it works in Prestashop 1.3.2.3 too Link to comment Share on other sites More sharing options...
Roues Posted November 26, 2010 Share Posted November 26, 2010 Great, thanks! Link to comment Share on other sites More sharing options...
Edowardo Posted December 22, 2011 Share Posted December 22, 2011 Thank you, Its work. And for the resizing of image as is what we want, you can combine or trying switch the ">" into "<" because, i'll try the first option, but the image not cropping following the image frame, and then i try to switch the mark above vise verse and success the image fit on the frame and the background not white. Link to comment Share on other sites More sharing options...
shugun Posted January 20, 2012 Share Posted January 20, 2012 its cool, thank you Link to comment Share on other sites More sharing options...
Prestapro.ru Posted January 20, 2012 Share Posted January 20, 2012 Hello. I'm from Russia sorry for my bad English. The method works for prestashop version 1.4.6.2. Only have to change another Fail - images.inc.php Change the sign of if (Configuration:: get ('PS_IMAGE_GENERATION_METHOD') == 2 OR (! Configuration:: get ('PS_IMAGE_GENERATION_METHOD') AND $ widthDiff <$ heightDiff)) on if (Configuration:: get ('PS_IMAGE_GENERATION_METHOD') == 2 OR (! Configuration:: get ('PS_IMAGE_GENERATION_METHOD') AND $ widthDiff > $ heightDiff)) If there are programmers or administrators interested I would like to add the ability to select a panel or module. On if (Configuration::get('PS_IMAGE_GENERATION_METHOD') == 2 OR (!Configuration::get('PS_IMAGE_GENERATION_METHOD') AND $widthDiff < $heightDiff)) If there are programmers or administrators interested I would like to add the ability to select a panel or module. Sincerely Demos Link to comment Share on other sites More sharing options...
cankart Posted January 22, 2012 Share Posted January 22, 2012 Hi Demos, can you show me one example please ? Thanks Link to comment Share on other sites More sharing options...
Amazzing Posted February 25, 2012 Share Posted February 25, 2012 Thank you for sharing! Simply changing ">" to "<" in "images.inc.php" worked for me. 1 Link to comment Share on other sites More sharing options...
KambinatoR Posted April 19, 2012 Share Posted April 19, 2012 Also worked on 1.4.5.1 PS: the file images.inc.php is in the root folder Link to comment Share on other sites More sharing options...
TiagoVieira Posted July 1, 2012 Share Posted July 1, 2012 worked in 1.4.7.3 after changing ">" to "<" just have to regenerate all thumbnails amd reload the protuct page. thank you a lot Link to comment Share on other sites More sharing options...
pow Posted July 4, 2012 Share Posted July 4, 2012 Can't prestashop provide some features like: Background-Color: #xxxx Rectangle-crop: yes/no crop-position: top/left/... This is all hardcoded :-( This is a feature-wish, don't know where to post elsewhere Link to comment Share on other sites More sharing options...
steve_c Posted August 13, 2012 Share Posted August 13, 2012 Hi just coming back to this thread. I have tried the above but it simply crops out the left and right sections of my landscape images so that they are square. I simply want landscape images with *no* white border at the top and the bottom. Surely this is possible somehow? Link to comment Share on other sites More sharing options...
mactsolutions Posted September 20, 2012 Share Posted September 20, 2012 is there a way to just crop the thumbnails or a specific image size and not the large photos? Link to comment Share on other sites More sharing options...
Publisher Posted April 2, 2013 Share Posted April 2, 2013 Very strange, changed: if (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 2 OR (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 0 AND $widthDiff > $heightDiff)) to: if (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 2 OR (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 0 AND $heightDiff > $widthDiff)) and it now seems to be working... Hope this helps anyone having similar issues Thanks a lot, works fine with PS 1.4.2.5 Link to comment Share on other sites More sharing options...
boogs Posted December 18, 2013 Share Posted December 18, 2013 Hi there, Does anybody get the trick for PS 1.5.6 cause there isn't any such line in my images.inc.php file ? Thanx Link to comment Share on other sites More sharing options...
sg1_anhell Posted November 25, 2014 Share Posted November 25, 2014 (edited) This works for Prestashop 1.6.0.9 BUT only for new uploads, If then I regenerate images on back office doesn't work, back to fill with white... In Prestashop 1.6 you will found the code lines in /classes/ImageManager.php for me was the line 166 Only I changed $width_diff > $height_diff for $width_diff < $height_diff Edited November 25, 2014 by sg1_anhell (see edit history) 1 Link to comment Share on other sites More sharing options...
mikajaxxxx Posted July 10, 2015 Share Posted July 10, 2015 There is anyway we have cropping for just specific image type? for example i want just product images cropped not the manufacturers! Link to comment Share on other sites More sharing options...
moy2010 Posted October 10, 2016 Share Posted October 10, 2016 I just found these PHP functions for auto-cropping images' background: http://php.net/manual/en/function.imagecropauto.php These could help us save some KB in total pageload size and improve our prestashop stores. Link to comment Share on other sites More sharing options...
m-v-d Posted November 23, 2021 Share Posted November 23, 2021 Since this topic pops up if you google on how to remove the white bars; I'd thought I'd write my solution for PrestaShop 1.7 here. Works for both formats, so portrait and landscape. Step 1: Open the following file: /classes/ImageManager.php Go to the line if ($fileType == 'png' && $type == IMAGETYPE_PNG) { and remove the last bit, so that it looks like: if ($fileType == 'png') { Step 2: In your Backoffice, go to Design > Image Settings and set Image Format to Use PNG for all images 1 Link to comment Share on other sites More sharing options...
kamppa Posted May 28 Share Posted May 28 On 11/23/2021 at 6:06 PM, m-v-d said: Since this topic pops up if you google on how to remove the white bars; I'd thought I'd write my solution for PrestaShop 1.7 here. Works for both formats, so portrait and landscape. Step 1: Open the following file: /classes/ImageManager.php Go to the line if ($fileType == 'png' && $type == IMAGETYPE_PNG) { and remove the last bit, so that it looks like: if ($fileType == 'png') { Step 2: In your Backoffice, go to Design > Image Settings and set Image Format to Use PNG for all images Any other solution to keep using JPG? Using PNG for product images is a bad idea because of the large image size. White borders in product pictures in mobile view are a bad idea. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now