Copied to clipboard

Flag this post as spam?

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


  • Darren Wilson 238 posts 646 karma points
    Nov 08, 2024 @ 16:08
    Darren Wilson
    0

    Media Crops have stopped working

    I have added media crops to the Image cropper property in the media doctype. They have stopped working on the front end - they have been working without any issues:

    <img src="/media/iabpa0ha/range.webp?width=350&amp;height=510&amp;rnd=133742607547232833" style="width:100%; height:auto" alt="360-degree intruder detection">
    

    This is the code that shows the media crop but the front end of the site is displaying the full size image. This has been working perfectly but has just stopped without any notice.

    There is an error in the log relating to images :

    @MessageTemplate='Sending image. Request uri: '{Uri}'. Cached Key: '{Key}''
    

    But there is no error details contained within it. Any ideas how to fix this?

    Thanks Darren

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Nov 08, 2024 @ 23:05
    Chriztian Steinmeier
    0

    Hi Darren,

    I've seen something similar at some point. I think it's happening because ImageSharp never "sees" the request (and thus, doesn't handle the parameters).

    In my case it was caused by something in one of the Startup.cs/Program.cs files, but I don't know enough about it to be able to tell you what's wrong.

    Do you know if anything has changed in one of those files (or if a newly installed component could have changed something)?

    /Chriztian

  • Darren Wilson 238 posts 646 karma points
    Nov 09, 2024 @ 13:19
    Darren Wilson
    0

    Hi Chriztian,

    Thanks for getting back to me - we have made a change to the startup.cs file to secure urls for some media items - perhaps this has something to do with it?

    // Custom media endpoint
                    u.EndpointRouteBuilder.MapControllerRoute(
                        "SecureMediaRoute",
                        "secure/{id?}/{file?}",
                        new
                        {
                            controller = "SecureMedia",
                            action = "Index"
                        }
                    );
    

    What do you think? Darren

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Nov 09, 2024 @ 14:28
    Chriztian Steinmeier
    0

    Hi Darren,

    Yes - I'm pretty sure that'll have something to do with it.

    I found the link I was looking for; where I learned about the fact that you can happen to (inadvertently) disable ImageSharp when adding stuff to the build/startup process:

    https://dev.to/cultiv/til-mime-types-and-static-assets-bdj

    Hope that helps you fix the issue,

    /Chriztian

  • Darren Wilson 238 posts 646 karma points
    Nov 11, 2024 @ 09:38
    Darren Wilson
    100

    Thanks Chriztian,

    I'll give this a try - the startup.cs thing you pointed out has fixed the issue.

    Darren

Please Sign in or register to post replies

Write your reply to:

Draft