Copied to clipboard

Flag this post as spam?

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


  • Liam Dilley 153 posts 379 karma points
    Dec 12, 2023 @ 01:37
    Liam Dilley
    0

    Media Middleware help - Security access for images

    Hi all, I have developed a great working package to have items secure, manage member groups and some other things. This works great and done through Middleware.

    But when you have a partial view be it from the Editor, direct image element type, media picker you then render HTML out like...

    <img src="PATHERE"  alt="AltText"/>
    

    And so on this returns a 500 error and the image wont render and you only see the alt text. The image is secure which is great but this is not ideal. I want to be able to render a security image placeholder instead.

    So in the code I have:

     context.Response.Redirect(denyUrl);
    

    I tried to write a function where the mediaItem Type was "Image" to then update it. I tried updating the context.Path and properties and while I get no errors it ultimately does not replace the rendered media item URL etc.

    Could anyone advise on this? Thank You

Please Sign in or register to post replies

Write your reply to:

Draft