-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[6.1] make media action crop aspect ratio configurable #46421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 6.1-dev
Are you sure you want to change the base?
Changes from 40 commits
2378ef9
c5ecf44
0a047f2
13e8aa0
2da2336
daedb7c
436e14b
9850572
59a8091
1409e67
3c83c9a
65fcf2e
db05b82
8d18b13
d79e1f7
f6fc598
c76424f
361715c
392019c
f751bd2
0a2c785
325034c
5dea148
aaeb7bd
afbc7d9
89e061c
5d1ee29
cdc90c2
92750e7
e7ff28e
16cdeee
e2c998a
3449a2d
402a702
4db306f
b6f6637
016baa5
4dd59c1
1c104a4
71ee773
4b1256d
042a355
ed574b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -19,4 +19,54 @@ | |||||
| <language tag="en-GB">language/en-GB/plg_media-action_crop.ini</language> | ||||||
| <language tag="en-GB">language/en-GB/plg_media-action_crop.sys.ini</language> | ||||||
| </languages> | ||||||
| <config> | ||||||
| <fields name="params"> | ||||||
| <fieldset name="basic"> | ||||||
| <field | ||||||
| name="aspect_ratios" | ||||||
| type="subform" | ||||||
| label="PLG_MEDIA-ACTION_CROP_ASPECT_RATIOS_LABEL" | ||||||
| description="PLG_MEDIA-ACTION_CROP_ASPECT_RATIOS_DESC" | ||||||
| multiple="true" | ||||||
| layout="joomla.form.field.subform.repeatable-table" | ||||||
| default='{"aspect_ratios0":{"label":"1:1","value":"1","group":""},"aspect_ratios1":{"label":"5:4","value":"5/4","group":"landscape"},"aspect_ratios2":{"label":"4:3","value":"4/3","group":"landscape"},"aspect_ratios3":{"label":"3:2","value":"3/2","group":"landscape"},"aspect_ratios4":{"label":"16:9","value":"16/9","group":"landscape"},"aspect_ratios5":{"label":"4:5","value":"4/5","group":"portrait"},"aspect_ratios6":{"label":"3:4","value":"3/4","group":"portrait"},"aspect_ratios7":{"label":"2:3","value":"2/3","group":"portrait"},"aspect_ratios8":{"label":"9:16","value":"9/16","group":"portrait"}}' | ||||||
| > | ||||||
hans2103 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| <form> | ||||||
| <field | ||||||
| name="label" | ||||||
| type="text" | ||||||
| label="PLG_MEDIA-ACTION_CROP_RATIO_LABEL_LABEL" | ||||||
| description="PLG_MEDIA-ACTION_CROP_RATIO_LABEL_DESC" | ||||||
| required="true" | ||||||
| filter="string" | ||||||
| /> | ||||||
| <field | ||||||
| name="value" | ||||||
| type="text" | ||||||
| label="PLG_MEDIA-ACTION_CROP_RATIO_VALUE_LABEL" | ||||||
| description="PLG_MEDIA-ACTION_CROP_RATIO_VALUE_DESC" | ||||||
| required="true" | ||||||
| pattern="([1-9]\d*/[1-9]\d*|[1-9]\d*)" | ||||||
|
||||||
| pattern="([1-9]\d*/[1-9]\d*|[1-9]\d*)" | |
| pattern="(\d+/\d+|\d+\.?\d*)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not want to support zero-based values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not want to support zero-based values.
that means you don't allow such values:
<option class="crop-aspect-ratio-option" value="0.8">4:5</option>
<option class="crop-aspect-ratio-option" value="0.75">3:4</option>
<option class="crop-aspect-ratio-option" value="0.6666666666666667">2:3</option>
<option class="crop-aspect-ratio-option" value="0.5625">9:16</option>
this options are all zero based.
I think we shouldn't force people to use the 1/2 since they might already get a 0.xyz value from another place and just want to copy paste it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn't force people to use the 1/2 since they might already get a 0.xyz value from another place and just want to copy paste it.
@HLeithner for real?
That is exactly what you suggested to do 4 days ago. Using a / to calculate implies adding as such too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You miss understand me, it's not a you MUST use x/y it's an optional thing. both should work. If I like to use 0.35 then that should be possible. But normally I would expect the more readable x/y variant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HLeithner at this moment Joomla does not allow to configure any aspect ratios. This PR provides a solution that people can configure aspect ratios. At first I added a calculator to create the required value for the aspect ratios.
After your suggestion, which was very valid, I have removed the calculator and moved the calculation of the required value to javascript. People just have to enter the aspect ratio as if they add it in css too..... with a slash between the two numbers.
This PR as it is right now works like a charm. If other kind of input is needed for better UI, please create a new PR when this is merged and adjust it. But please... continue with the PR as it is right now.
Uh oh!
There was an error while loading. Please reload this page.