[MGNLIMG-212] Don't scale up small images and make it configurable Created: 01/Apr/19 Updated: 29/Aug/22 |
|
| Status: | Open |
| Project: | Imaging |
| Component/s: | None |
| Affects Version/s: | 3.4.2 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Viet Nguyen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | imaging | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Template: |
|
||||
| Acceptance criteria: |
Empty
|
||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||
| Release notes required: |
Yes
|
||||
| Documentation update required: |
Yes
|
||||
| Date of First Response: | |||||
| Description |
|
Follow SUPPORT-9771,
After investigated, I have found that setting 'expand' property to 'false' will not expand your image according to our implementation below: However it is not documented yet. Also if users are using ThemeAwareImageGenerator, this 'expand' property is not configurable from its SimpleResizeVariation. Expected result:
|
| Comments |
| Comment by Jeffrey van der Heide [ 28/Jun/19 ] |
|
@Viet Nguyen: In the mean time we're using our own implementation that extends the default and allows for the expand parameter to be used in the theme e.g.: class SimpleResizeVariation extends info.magnolia.templating.imaging.variation.SimpleResizeVariation { private boolean expand = true; @Inject public SimpleResizeVariation(SiteManager siteManager) { super(siteManager); } /** * Identical to super class, except for the additional expand parameter. */ @Override public void init() { if (getImageOperation() == null) { final ImageOperationChain<ParameterProvider<Node>> chain = new ImageOperationChain<ParameterProvider<Node>>(); chain.addOperation(new FromBinaryNode()); if (super.isCrop()) { final AutoCropAndResize resize = new AutoCropAndResize(); resize.setResizer(new MultiStepResizer()); if (getWidth() != null) { resize.setTargetWidth(getWidth()); } if (getHeight() != null) { resize.setTargetHeight(getHeight()); } chain.addOperation(resize); } else { final BoundedResize resize = new BoundedResize(); resize.setExpand(this.expand); resize.setResizer(new MultiStepResizer()); if (getWidth() != null) { resize.setMaxWidth(getWidth()); } if (getHeight() != null) { resize.setMaxHeight(getHeight()); } chain.addOperation(resize); } setImageOperation(chain); } } public boolean isExpand() { return expand; } public void setExpand(boolean expand) { this.expand = expand; } }
imaging:
class: info.magnolia.templating.imaging.VariationAwareImagingSupport
variations:
logo:
class: nl.example.templating.imaging.variation.SimpleResizeVariation
width: 256
height: 128
crop: false
expand: false
|