Copied to clipboard

Flag this post as spam?

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


  • k 256 posts 654 karma points
    Jan 12, 2016 @ 11:53
    k
    0

    image src empty

    I am encountering this issue since tha last weeks, and I am not able to find a fix.

    Would be grateful if someone could help.

    Thanks.

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Jan 12, 2016 @ 15:38
    Alex Skrypnyk
    0

    hi k,

    Can you provide the code ?

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Jan 12, 2016 @ 15:59
    Nik
    1

    Hi K,

    You aren't really explaining the problem. Without knowing more about what you are doing it will be impossible for someone to help.

    Try sharing appropriate code snippets (e.g. your view if it's not to big). An explanation of your DataType and what you've tried in order to debug it.

    With that people would be able to either help by pointing you in the right direction, provide a solution or ask more targeted questions to gain further insight in order to help.

    Thanks,

  • TheOriginal 22 posts 122 karma points
    Jan 13, 2016 @ 13:35
    TheOriginal
    0

    Are you using all the following steps:

    1. Get image id as a string
    2. pass in imageId variable into the .TypedMedia(imageID) function

    then when you use the imageUrl variable make sure you add .Url at the end

    an example of what i mean is:

    var imageLocation = Model.Content.Descendants();
    var imageId = imageLocation.GetPropertyValue<string>("imageAlias");
    var imageSrc = imageLocation.TypedMedia(imageID); 
    <img src="@imageSrc.Url" />
    

    The above should be the sort of thing your looking for it works by getting the image path, then you define the image by it's alias which returns it's id. You then turn this to a string and pass it into the .TypedMedia() function which returns the media picker value. Then when using the imageSrc variable ensure to add ".Url" at the end to convert to a url

Please Sign in or register to post replies

Write your reply to:

Draft