added new image format options
Details
Preparations
In the themes\advanced\in-bulletin\elements\side_boxes\polls.elm.tpl template add below code at the beginning of poll_element element:
<img src="<inp2:Field name='Image' format='resize:480x640;crop:100|200;quality:10;orientation:auto'/>" border="0" alt="<inp2:Field field='Question'/>"> <img src="<inp2:Field name='Image' format='resize:x480;orientation:landscape'/>" border="0" alt="<inp2:Field field='Question'/>"> <img src="<inp2:Field name='Image' format='resize:x480;orientation:portrait'/>" border="0" alt="<inp2:Field field='Question'/>"> <img src="<inp2:Field name='Image' format='resize:640x480;output_format:png'/>" border="0" alt="<inp2:Field field='Question'/>"> <img src="<inp2:Field name='Image' format='resize:5000x5000;output_format:png'/>" border="0" alt="<inp2:Field field='Question'/>"> <img src="<inp2:Field name='Image' format='resize:5000x5000;output_format:jpg'/>" border="0" alt="<inp2:Field field='Question'/>"> <img src="<inp2:Field name='Image' format='resize:5000x5000'/>" border="0" alt="<inp2:Field field='Question'/>">
Testing
- Make sure In-Bulletin module is active and advanced theme is selected as default theme
- Go to Catalog & Website → Polls section
- Create poll without answers, but with big enough (more than 640x480) landscape jpg image
- Go to front-end forums.html page
- Confirm, that 1st image shown is landscape, bad quality, cropped by horizontal axis 2x more, than by vertical
- Confirm, that 2nd image shown have height 480px
- Confirm, that 3rd image shown have width 480px
- Confirm, that 4th image shown is in png format
- Confirm, that 5th image (for this to work uploaded image must be less than 5000x5000) has png extension
- Confirm, that 6th image (for this to work uploaded image must be less than 5000x5000) has jpg extension
- Confirm, that 7th image (for this to work uploaded image must be less than 5000x5000) has jpg extension
Crash testing
In the themes\advanced\in-bulletin\elements\side_boxes\polls.elm.tpl template, in the code, added at the beginning of poll_element element, change requested format part value, refresh page and see result:
- Change quality to -5
- Confirm that exception "Quality value "-5" is out of 0..100 integer range." is thrown
- Change quality to 105
- Confirm that exception "Quality value "105" is out of 0..100 integer range." is thrown
- Change quality to 1.5
- Confirm that exception "Quality value "1.5" is out of 0..100 integer range." is thrown
- Change quality to 100
- Change output_format to tiff
- Confirm that exception "Output format value "tiff" is out of [jpg,png,gif,bmp,auto] range." is thrown
- Change output_format to png
- Change orientation to normal
- Confirm that exception "Orientation value "normal" is out of [auto,manual,portrait,landscape] range." is thrown
- Change orientation to portrait
- Where orientation is auto change resize to 480x
- Confirm that exception "Both width & height parameters must be specified." is thrown
- Where orientation is auto change resize to x640
- Confirm that exception "Both width & height parameters must be specified." is thrown
- Where orientation is auto set resize to 480x640
Diff Detail
- Repository
- rINP In-Portal
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
In the themes\advanced\in-bulletin\elements\side_boxes\polls.elm.tpl change poll image output code to:
Please change this to:
In the `themes\advanced\in-bulletin\elements\side_boxes\polls.elm.tpl` template add below code at the beginning of `poll_element` element:
Right now it's not obvious what template fragment needs to be changed.
core/units/helpers/image_helper.php | ||
---|---|---|
38 ↗ | (On Diff #910) | Example for output_format and orientation options is missing. |
57–59 ↗ | (On Diff #910) | Not covered in test plan. |
64–68 ↗ | (On Diff #910) | Not covered in test plan. |
73–77 ↗ | (On Diff #910) | Not covered in test plan. |
152–154 ↗ | (On Diff #910) | Not covered in test plan. |
649–655 ↗ | (On Diff #910) | Please combine error messages and conditions (if either of dimensions isn't specified, then exception). |
core/units/helpers/image_helper.php | ||
---|---|---|
649–655 ↗ | (On Diff #910) | There is nothing to combine. This method is called only when at least one resize dimension is specified. |
core/units/helpers/image_helper.php | ||
---|---|---|
649–655 ↗ | (On Diff #910) | I've meant this change: if ( $dst_width === '' || $dst_height === '' ) { throw new InvalidArgumentException('Both width & height parameters must be specified.'); } |