Copied to clipboard

Flag this post as spam?

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


  • Jon 92 posts 166 karma points
    Feb 24, 2021 @ 09:45
    Jon
    0

    Umbraco 8 - Media path issue

    Hi,

    In the current Umbraco 8 CMS when you add an image to a web page the url to that image is something similar to - /media/dfsdf8sd/my-image.jpg where is obviously a generated id that knows the image id. But what we need is the full path, for example media/folder1/folder2/my-image.jpg.

    Is this possible?

    Thanks

    Jon

  • Mehmet Avcı 55 posts 240 karma points
    Feb 24, 2021 @ 11:00
    Mehmet Avcı
    0

    Hi Jon,

    Please correct me if I understood this wrong; but in "/media/dfsdf8sd/my-image.jpg" section "dfsdf8sd" is not your image's id in the db. This is an auto generated folder name. If you check your media folder, you will see that there is a real folder in that name (if you are using blob then a blob name).

    So in this context that is actual path.

    Best,

    Mehmet

  • Jon 92 posts 166 karma points
    Feb 24, 2021 @ 11:06
    Jon
    0

    Ok that is great - the issue we have is that we are moving a site from one platform to Umbraco. People will have Links to PDFs which are in training documentation. On the old platform the urls are like media/folder1/folder2/folder3/my-doc,pdf but if we match the same folder path in Umbraco media the old URL in the training document wont be able to find that pdf as the URL is media/dfsdf8sd/my-doc.pdf in Umbraco, regardless of matching folder names.

    Is there a way that we can match them up or have some sort of rewrite rule?

    Thanks

  • Mehmet Avcı 55 posts 240 karma points
    Feb 24, 2021 @ 11:33
    Mehmet Avcı
    0

    Yes of course, you can add redirections in IIS which would perform quite fast.

    Best,

    Mehmet

  • Jon 92 posts 166 karma points
    Feb 24, 2021 @ 11:36
    Jon
    0

    But how can you do that if each pdf has a dynamically generated id in the path? You would need to go through every PDF, adding it to a page just to get this id? Or am I missing something?

  • Mehmet Avcı 55 posts 240 karma points
    Feb 24, 2021 @ 11:45
    Mehmet Avcı
    0

    When you add upload a media file in the backoffice you can see filepath right away - so you don't need to add it to a page.

    On the other hand, yes, you cannot predict that folder name, so you would need to add manually.

    If you like to do it dynamically, you can create a code based solution. However this will also require you to add an information into the node that points to some meaningful connection to previous path. This won't really be the ideal solution for you in terms of work required to achive this and chances to fail in specific cases. For example it will be really hard for you to find out if you add same filepath to 2 nodes without knowing it.

Please Sign in or register to post replies

Write your reply to:

Draft