Copied to clipboard

Flag this post as spam?

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


  • Snow lizard 36 posts 106 karma points
    Apr 12, 2017 @ 11:02
    Snow lizard
    0

    How do I hide the file path on an image with imageGen?

    Hi,

    How do I hide the file path on an image with imageGen?

    I upload my image using the media picker and it has a path of e.g

    /media/1234/graphic.jpg

    I understand the way to protect the file path is to use a class with the ImageBaseDir as below. However the sub folder will be different for each image. Can someone tell me how I should protect my file path? Thanks

  • Douglas Robar 3570 posts 4670 karma points MVP 6x admin c-trib
    Apr 12, 2017 @ 11:28
    Douglas Robar
    1

    Hi, Alan,

    You're correct, the most you can do is hide the /media/ portion of the path with ImageBaseDir since that's the only consistent part of the path.

    True, someone might figure out your site is running Umbraco and guess that the images really reside in the /media/ folder and guess a full path to the original image.

    Not hugely likely but if that's a concern you might want to add some router rules that ensure all http(s) requests to /media/ include imagegen.ashx as part of the request, making it impossible to get to the original files from the public internet (you'd probably want to allow access for local and internal access). Or you could use IIS rewrite rules to create a similar effect. You could obscure things considerably by rewriting requests significantly. For example:

    Instead of /imagegen.ashx?class=secret&image=/1234/graphic.jpg you could rewrite it to something like /mediacache/graphic/secret/1234.jpg with all the parts of the path representing portions of the real request for quick and easy rewriting while giving away little useful information.

    Hope this helps.

    cheers,
    doug.

  • Snow lizard 36 posts 106 karma points
    Apr 12, 2017 @ 11:36
    Snow lizard
    0

    Thanks Douglas that's great!

Please Sign in or register to post replies

Write your reply to:

Draft