Copied to clipboard

Flag this post as spam?

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


  • Søren Reinke 158 posts 206 karma points c-trib
    Mar 22, 2012 @ 13:07
    Søren Reinke
    0

    media getProperty always returning null

    I have a problem with 'getProperty' on a Media object.

    I have this code:

    var media = umbraco.cms.businesslogic.media.Media.GetRootMedias();
    var employees = (from m in media where m.Text == "Employees" select m).First();
    foreach(var img in employees.Children)
    {
        var text = img.Text;
        var id = img.Id;
        var width = img.getProperty("umbracoWidth");
        var height = img.getProperty("umbracoHeight");
        var file = img.getProperty("umbracoFile");
        var all = img.getProperties;
    }

    'text' and 'id' contains the correct values.

    But 'width', 'height', 'file' are all null, and 'all' has a count of 0

    In the umbraco backend i can see the width, height and more.


    I am trying to make a little program, going through all the pictures in the 'Employees' folder, make sure all of them have a width and a height, some of them was created without this data.

    The images i am playing with at the moment does have height and width.

    The version is: umbraco v 4.0.2.1 (Assembly version: 1.0.3441.17657) (i know it is ancient, and i can't upgrade)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies