Copied to clipboard

Flag this post as spam?

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


  • Thomas Kassos 54 posts 265 karma points
    Aug 22, 2021 @ 00:22
    Thomas Kassos
    0

    GetCropUrl Not Working - U9

    Hello,

    I have seen that some issues related to ImageProcessor or ImageSharp has been fixed for the RC2 and I was hopping what these will fix my issue as well, but they didn't.

    I am trying to get a crop image.

    I have tried with width and height as parameters and with crop alias. I have also tried it with the media picker 2 and 3.

    here is some code I used to test it

    @inject INodeFinderService _nodeFinderService;
    
    @{
        MediaWithCrops icon = _nodeFinderService.GetGlobalSettings().FavIconAndTouchIcon;
        IEnumerable<ImageCropperValue.ImageCropperCrop> iconCrops = icon.LocalCrops.Crops;
    }
    <div>
        <div class="d-inline-block m-2">
            <img src="@icon.GetCropUrl(10, 10)">
            <br>
            <span>
                <b>10, 10</b>
            </span>
            <br>
            <span>
                <b>Url:</b> @icon.GetCropUrl(10, 10)
            </span>
        </div>
    
        <div class="d-inline-block m-2">
            <img src="@icon.GetCropUrl(50, 60)">
            <br>
            <span>
                <b>50, 60</b>
            </span>
            <br>
            <span>
                <b>Url:</b> @icon.GetCropUrl(50, 60)
            </span>
        </div>
    
        @foreach (var item in iconCrops)
        {
            <div class="d-inline-block m-2">
                <img src="@icon.GetCropUrl(item.Alias)">
                <br>
                <span>
                    <b>Alias:</b> @item.Alias
                </span>
                <br>
                <span>
                    <b>Url:</b> @icon.GetCropUrl(item.Alias)
                </span>
            </div>
        }
    </div>
    

    and that's the result (I have zoomed out to fit all the images in the screen)

    enter image description here

    Any help would be much appreciated!!!

    Thanks, Thomas

  • Thomas Kassos 54 posts 265 karma points
    Sep 13, 2021 @ 15:27
    Thomas Kassos
    105

    It turns out after the U9 RC002 the crop URL works fine. The issue I had was a setting I had add in the startup.cs, the "app.UseStaticFiles()" . The image processor doesn't work with that!

  • David Armitage 508 posts 2078 karma points
    Apr 14, 2022 @ 08:21
    David Armitage
    1

    Thanks Thomas. That really helped me out.

Please Sign in or register to post replies

Write your reply to:

Draft