Copied to clipboard

Flag this post as spam?

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


  • paulthorpe 10 posts 193 karma points
    Apr 06, 2017 @ 10:52
    paulthorpe
    0

    I have a rather odd issue on an site that has been running for a while. Suddenly some images are not showing and if I go to the image path directly I get a 404.

    Within the Media Library the Image exists but the image doesn't show. Where the image would show is just text stating Upload Image but there is no Upload image button to actually upload something.

    I have looked on the web server and the images exist within the file structure in the correct location so Umbraco must be doing something to force the 404.

    The only thing I have noted is that the path to the image is media/1443/filename.jpg but within the umbracoNode database table the id is 2032 and the back end properties show the id as 2032 should all the numbers be the same? And if so what has happened and is there a fix?

    I am using version 7.5.3 any help appreciated.

  • paulthorpe 10 posts 193 karma points
    Apr 06, 2017 @ 12:32
    paulthorpe
    101

    I seem to have solved my own issue but there seems to be an issue with

    MediaService.GetMediaByPath()

    In a standard controller the correct path is generated e.g. /media/1234/FileName.jpg

    but the following does not return the media object it just returns null.

    IMediaService mediaService = ApplicationContext.Current.Services.MediaService;

    IMedia media = mediaService.GetMediaByPath("/media/1234/FileName.jpg");

Please Sign in or register to post replies

Write your reply to:

Draft