Try our conversational search powered by Generative AI!

Maciej Golis
Jan 8, 2019
  3048
(3 votes)

Image Cropper Property Editors (using ImageResizing.NET)

Happy New Year All!

There are many ways an image crop can be defined. As we know, editors do like as much flexibility as possible :) Having discussed various approaches with multiple content teams, we have decided to enable cropping at the page or block level.  

We made 2 editors available:

  • Image Reference
  • Image Reference List

The aspect ratio can be defined for each instance of the property editor individually

Usage

Image can be assigned by drag and dropping it into the drop zone:

Once the image is dropped, Image Cropper dialog is displayed:

Of course, any image can be edited or deleted at any point. Moreover images in Image Reference List editor can be reordered:

Implementation

The NuGet package is available in the EPiServer Nuget Feed. The source code and the implemenation guide can be found on GitHub.

Jan 08, 2019

Comments

Jan 8, 2019 03:26 PM

What I'd like it to be able to fix the ratio. If a shared image is being used in a block/page that's a fixed 16/9 area it would be good that the editor only supported that ratio and would mean large images could be reused across the board. Else users can still crop an image out that then when rendering through might be displayed in a different ratio

Maciej Golis
Maciej Golis Jan 8, 2019 06:46 PM

Hi Scott,

This is something that is supported out of the box. Please have a look at the code snippet below:

[ImageReference(CropRatio = (double)16/9)]
public virtual ImageReference SingleImage { get; set; }

Thanks, M

valdis
valdis Jan 9, 2019 06:31 PM

hey, this is nais that you finally packed it up as nugget :) would be cool if you could add syntax sugars for rendering picture tag as well (https://github.com/valdisiljuconoks/ImageResizer.Plugins.EPiServerBlobReader#render-picture-element).

also would be awesome to jump to StructureMap v4.x

don't take it like critisism :), I just don't have naything else to do as reviewing foreign code.. i added coupe github issues. just my old man 2 cents :)

Please login to comment.
Latest blogs
Run imgproxy container on Azure App Service with Front Door CDN

A simple way to host a imgproxy Docker container and use it to get AVIF and WEBP images.

Johan Kronberg | May 5, 2024 | Syndicated blog

Why C# Developers Should Embrace Node.js

Explore why C# developers should embrace Node.js especially with Optimizely's SaaS CMS on the horizon. Understand the shift towards agile web...

Andy Blyth | May 2, 2024 | Syndicated blog

Is Optimizely CMS PaaS the Preferred Choice?

As always, it depends. With it's comprehensive and proven support for complex business needs across various deployment scenarios, it fits very well...

Andy Blyth | May 2, 2024 | Syndicated blog

Adding market segment for Customized Commerce 14

Since v.14 of commerce, the old solution  for adding market segment to the url is not working anymore due to techinal changes of .NET Core. There i...

Oskar Zetterberg | May 2, 2024

Blazor components in Optimizely CMS admin/edit interface

Lab: Integrating Blazor Components into Various Aspects of Optimizely CMS admin/edit interface

Ove Lartelius | May 2, 2024 | Syndicated blog

Anonymous Tracking Across Devices with Optimizely ODP

An article by Lead Integration Developer, Daniel Copping In this article, I’ll describe how you can use the Optimizely Data Platform (ODP) to...

Daniel Copping | Apr 30, 2024 | Syndicated blog