juhis Posted September 10, 2013 Share Posted September 10, 2013 Hi, I have set image cropping to false like this: $options = array( 'upscaling' => true, 'cropping' => false, 'quality' => 90 ); <- this is from the cheatsheet $thumb = $item->image->size(120, 50, $options); ...for some reason image gets cropped anyway. I'm using processwire 2.3.0. Does this work only if width or height is 0? Link to comment Share on other sites More sharing options...
RyanJ Posted September 10, 2013 Share Posted September 10, 2013 From the cheat sheet To resize and keep proportions you can 0 for height or width value. 1 Link to comment Share on other sites More sharing options...
horst Posted September 10, 2013 Share Posted September 10, 2013 @RJay: yes that's right, - but also it is right that if you want to keep proportions and want that they fit into max dimensions for width *and* height you can call: size( $myMaxWidth, $myMaxHeight, array('cropping'=>false) ); For example: http://nogajski.de/priv/postings/rearrangedImageSizer.html#sizeNoCrop & http://nogajski.de/priv/postings/rearrangedImageSizer.html#sizeCrop 3 Link to comment Share on other sites More sharing options...
juhis Posted September 12, 2013 Author Share Posted September 12, 2013 Thanks! It seem's that maxwidth and maxheight need to be equal values like this: size( 100, 100, array('cropping'=>false) ); This is not working $item->image->size(120, 50, $options); Link to comment Share on other sites More sharing options...
horst Posted September 12, 2013 Share Posted September 12, 2013 It seem's that maxwidth and maxheight need to be equal values like this: size( 100, 100, array('cropping'=>false) ); This is not working $item->image->size(120, 50, $options); Hi J1312, but this must work too! I haven't a 2.3 stable version installed here, only latest dev, so I cannot test. But it sounds not logical. What are the dimensions of the original image and what is the setting for upscaling? Maybe a typo in $options, please use: size( 80, 90, array('cropping'=>false, 'upscaling'=>true) ); OH, blink-blink: you also should use removeVariations() first, while testing. please use: $image = $page->images->first(); if($image) { $image->removeVariations(); // otherwise it may take a previous cached version instead of create a new one echo "<img src='{$image->size( 80, 90, array('cropping'=>false, 'upscaling'=>true) )->url}' />"; } 2 1 Link to comment Share on other sites More sharing options...
kongondo Posted September 12, 2013 Share Posted September 12, 2013 I haven't a 2.3 stable version installed here, only latest dev, so I cannot test. But it sounds not logical. What are the dimensions of the original image and what is the setting for upscaling? <aside>I have one main PW install for testing stuff. I have have two wire folders. named "stable-wire" and "wire". The former has, well, the stable version of PW and the one for my daily use has the "dev" version. If I need to test something in the stable version, I temporarily rename the folders. "stable-wire" becomes "wire" and "wire" becomes "dev-wire". I used to have two different installs but thought that didn't make sense since PW core is in the wire folder. Am doing this the "wrong" way? </aside> Apologies for temporarily hijacking this thread Link to comment Share on other sites More sharing options...
juhis Posted September 12, 2013 Author Share Posted September 12, 2013 Really should have tested with more dimensions, removeVariations() did the trick. Good to know for future use, thank you very much 1 Link to comment Share on other sites More sharing options...
ryan Posted September 14, 2013 Share Posted September 14, 2013 <aside>I have one main PW install for testing stuff. I have have two wire folders. named "stable-wire" and "wire". The former has, well, the stable version of PW and the one for my daily use has the "dev" version. If I need to test something in the stable version, I temporarily rename the folders. "stable-wire" becomes "wire" and "wire" becomes "dev-wire". I used to have two different installs but thought that didn't make sense since PW core is in the wire folder. Am doing this the "wrong" way? </aside> I think that's okay, but it could be problematic in some cases like when file locations are different between master and dev, or when dev is using an updated DB schema from master. I don't think that either is the case right now, but just something to watch out for. The safest bet is to run them on separate databases. In your current setup, worst case is probably that you could end up being only able to run dev (with some part of the DB schema not compatible with the older stable branch). The changing file locations is not so much of an issue, but if you get errors you might need to manually clear the Modules cache (i.e. remove all /site/assets/cache/Modules.* files). 1 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