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 43 posts 227 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 43 posts 227 karma points
    15 days ago
    Thomas Kassos
    100

    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!

Please Sign in or register to post replies

Write your reply to:

Draft