Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Chris Smith 39 posts 142 karma points
    Jan 27, 2023 @ 16:35
    Chris Smith
    0

    Using the image cropper to crop umbraco images called from a 3rd party api

    Hi. Bit of an odd one!

    So pretty much every website we build has a news and events section so in the end we decided to build our own central news and events MVC websites then use our own API to display the relevant news and events items on each website.

    The images each news or event item has stored against it is an Umbraco hosted image from the relevant Media section of each site, in our bespoke apps we simply store the image's url against that item's record. I.e. https://thatwebsite.com/media/123/image.jpg. - We use the Umbraco Media service in our own apps to allow the user to select an image from an Umbraco site.

    The issue we're having is as the data being rendered on the website is coming back from our own API as a string rather than Umbraco data we've got no way of using the .GetCropUrl to crop the image.

    Has anyone had to do something similar and found a way use the image cropper when the Umbraco Media is actually being read back into the view via a 3rd party API?

    I've put this in the v8 section but we'll be trying to do the same thing on the site's we're now migrating to v10+.

    Cheers

    Chris

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Jan 29, 2023 @ 11:16
    Marc Goodson
    0

    Hi Chris

    With ImageProcessor which is the image processing library used in V7 and V8 you can send 3rd party hosted Urls through the image processing pipeline, and resize/crop etc, by 'whitelisting' the domain they are hosted on in security.config, and calling them via a the handler'remote.axd'

    More info here: https://imageprocessor.org/imageprocessor-web/imageprocessingmodule/

    However V10 uses ImageSharp, and this feature is not available (on purpose) in ImageSharp, however somebody did put a gist of how you might extend ImageSharp to register a custom RemoteImageProvider:

    https://gist.github.com/marklagendijk/e5fd1934391a515f8c974c87024ed39c

    That might be a starting point to creating something that would work for you on your latest sites?

    I guess the other notion would be to for your central MVC website to 'push' the content and image into a the specific Umbraco site, like syndication, so the native image manipulation options would be available in the individual site.

    regards

    Marc

  • Chris Smith 39 posts 142 karma points
    Feb 01, 2023 @ 08:21
    Chris Smith
    0

    Thanks Marc we'll take a look at these options.

Please Sign in or register to post replies

Write your reply to:

Draft