Copied to clipboard

Flag this post as spam?

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


  • Ian Robinson 79 posts 143 karma points
    Jun 29, 2012 @ 13:05
    Ian Robinson
    0

    Setting media types icon and thumbnail

    Hi,

    I'm creating new media type from a .net user control but I can't seem to set the media type's icon or thumbnail:

    MediaType gImage = MediaType.MakeNew(umbraco.BusinessLogic.User.GetCurrent(), "Bespoke Image");

    gImage.IconUrl = "~/umbraco/images/umbraco/mediaPhoto.gif";
    gImage.Thumbnail = "~/umbraco/images/thumbnails/docWithImage.png";
    gImage.Save();

    Can anyone tell me what I'm doing wrong?  There's also a property type called "Image", should I be using that instead?  e.g. gImage.Image = "~/umbraco/images/thumbnails/docWithImage.png";

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 29, 2012 @ 14:40
    Tom Fulton
    1

    Hi Ian,

    Those are the correct properties, but I think you only need to store the image name ie "mediaPhoto.gif" or "docWithImage.png", umbraco adds the path information automatically.

    HTH,
    Tom 

  • Ian Robinson 79 posts 143 karma points
    Jun 29, 2012 @ 20:34
    Ian Robinson
    0

    Thanks Tom, you were right.  I removed the paths and left only the filenames and it worked.

    I still don't know what the .Image property is for, but setting the IconUrl and Thumbnail is what I needed, so thank you!

Please Sign in or register to post replies

Write your reply to:

Draft