silverstripe-asset-admin
silverstripe-asset-admin copied to clipboard
Allow custom dimensions without ratio binding in "insert media"
Acceptance Criteria
- As a CMS author I can opt out of the default ratio binding of dimensions in the "insert media" and "insert image" modals
Notes
- Based on the InsertMediaModal work here https://github.com/silverstripe/silverstripe-asset-admin/pull/307
The "keep ratio" feature already exists in "insert media" and "insert image", so the ACs are confusing. Removed the following AC:
Dimension ratios could be kept and updated as the user updates one of the dimensions of an image in the "insert media" modal
Pointer for how to approach this:
Check out the ProportionConstraintField component in asset-admin.
Currently it has an active property, which will need transferring to either a redux state or react component state (either is fine, brownie points for redux state)
Then it will require a button or other interface to toggle the active property to turn on or off the constraint.
I can't think of a common use case for changing the aspect ratio of an inserted image (it'll always distort its contents). I bet there are some, but that signals to me that it's not a beta2 issue - removing milestone
@chillu here's a good counter-argument; Sometimes the width is known, but the height is guessed. In this case, we need to allow the user to either leave this blank (it'll auto-size) or specify a known height.
See https://github.com/silverstripe/silverstripe-cms/issues/1921 for reference.
This issue (or something like it) seems to be affecting 4.4.4.
- Hit "Insert Media"
- Paste this YouTube URL: https://www.youtube.com/embed/hwe3nwiAptY
- Observe default width (480) and height (270) is shown
- Try to adjust it to 650 x 366 (It's also a bit fiddly becuase the text-input area's JS prevents users from deleting the last digit)
- HIit the "Insert Media" button again
- Save the page
- Review the frontend, and inspect the generated
This issue is still happening. I have created the youtube link and tried to set it to 640 x 330. After saving the change, the iframe still has default dimensions width="480" height="270". One thing I noticed is the parent div thumbnail render style="width: 640px;". If it also has the height in the styling, the issue can be solved.
A little late, but the points made in the last two comments relate to the following open issue: https://github.com/silverstripe/silverstripe-framework/issues/8251