Open inhumator opened 5 years ago
I would like to see croping and resizing (not limited to fixed values) as part of Media module.
You can request a resized image either via razor taghelper or via liquid filters https://orchardcore.readthedocs.io/en/dev/OrchardCore.Modules/OrchardCore.Media/#razor-image-resizing-tag-helpers
We can add a zone for custom actions (where the Edit and Delete buttons are I assume). We do that already in Orchard 1, that would be an awesome contribution.
Can you do it? We just need to ensure that each time an asset is rendered in the admin, we use a BuildDisplay call. It doesn't have to be a content item (we do it for Deployment steps for instance).
Then in the asset template we just need to add a zone. And other modules can then create a display driver for an asset and inject a shape in this zone.
I think @inhumator 's intention is extension and crop the image before saving to the site. people only need to implement IImageService to upload cropped image, and do not need modify the code.
I think it would be nice to extend the built-in support in OC image handling for cropping by being able to define the Point Of Interest of an image in some way. Instead of just using:
{{ 'animals/kittens.jpg' | asset_url | resize_url: width:100, height:240, mode:'crop' }}
which will always crop simmetrically from the edges, the syntax could be extended to something like:
{{ 'animals/kittens.jpg' | asset_url | resize_url: width:100, height:240, mode:'crop', poi.x:0.25, poi.y:0.5 }}
this example would shift the point of interest to the 1st left quarter of the image and keep it at the center in the Y-axis.
Not using poi's at all would be as going for a default value of (0,5, 0.5), ie. the center of the image in both axis.
I think it would be nice to extend the built-in support in OC image handling for cropping
@jagbarcelo @deanmarcussen is working on a cropping PR #7209
Is it possible to easily extend the Media module ? We want to add image croping and resizing functions to the assets library - we managed to do that by modifying the source of existing module but I was wondering is there a way to override the Media view and controller without copying the whole Media module ?