bwakad Posted August 20, 2014 Posted August 20, 2014 Unfortunatly I did not find information of front-end image crop. But I did notice images can be manipulated for output using: $thumb = $page->image->size(200,200); echo "<img src='{$thumb->url}'/>"; It looks like a center -cropping, -clipping, or -resize (not sure). Since an uploaded image in landscape let me see the center part of the big image. My question: is there a function in pw, to be used in forms, that let users choose to display center, left or right ?
horst Posted August 20, 2014 Posted August 20, 2014 I think not a "special PW-function" but what's about radio buttons in your form with left - center - right and within form processing you crop the images west - center or east, according to the selected radio button?
bwakad Posted August 20, 2014 Author Posted August 20, 2014 was thinking about that too. But in the docs on pw it says these options can be placed in the config. That leaves me with only 1 option...
horst Posted August 20, 2014 Posted August 20, 2014 (edited) was thinking about that too. But in the docs on pw it says these options can be placed in the config. That leaves me with only 1 option... Uhh? Where does it say that? This would be new to me. (good reference is here) Edited August 20, 2014 by horst added a good reference, :)
bwakad Posted August 21, 2014 Author Posted August 21, 2014 link from the PW docs "images" (there are 2 entries for images) ... http://processwire.com/api/fieldtypes/images/ You may modify the default $options that your system uses by adding a $config->imageSizerOptions in your /site/config.php file: $config->imageSizerOptions = array( 'upscaling' => true, 'cropping' => true, 'quality' => 90, ); A little further it says: You may specify any of the following for the $options array:of which cropping as direction is part of it.If I can set these in config, then I am bound by 1. Correct?
Martijn Geerts Posted August 21, 2014 Posted August 21, 2014 not correct From the docs $options = array( 'quality' => 90, 'upscaling' => false, 'cropping' => 'southeast' ); $img = $image->size($x, $y, $options); 1
horst Posted August 21, 2014 Posted August 21, 2014 it says: default option, not the only one you can have. As far as I know defaults, they will be taken if you have not specified an individual value for something.
bwakad Posted August 22, 2014 Author Posted August 22, 2014 Oh okay, so in the options are just defaults as fallback. And in templates I can use different. Thanks! 1
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