I tried using the Media Picker but I was getting the same results. No matter what I try I just can't get the URL into an image!I 'm also quite unsure how to get the pictures to be scaled to specific dimensions. If I could get some help that would be great.
You can do it in two ways one way is by using a Partial Views, or antother way is by uing Partial View Macro. The code snippet you have to right is the same, the difference is the way you added the file to your template.
But if you want to get the image from the currentpage and you are using a media picker with alias of test, you could use the lines of code to get the image.
@{ if (CurrentPage.HasValue("test")){ var dynamicMediaItem = Umbraco.Media(CurrentPage.test); <img src="@dynamicMediaItem.umbracoFile" alt="@dynamicMediaItem.Name" width="@dynamicMediaItem.umbracoWidth" height="umbracoHeight"/> } }
But if you want to use the code you already have the only thing you´re missing this the image tag, since you get the path to the image, as I see it from the links you are provide in your post.
Image is being displayed as URL; not as Image
Hey Forum,
I'm having this issue: The Image is being display as a URL rather than showing an image.
http://imgur.com/xaqv4op
In my views I have this:
http://pastebin.com/Y78FZbgD
My back Office looks like this:
http://imgur.com/wtk8nkF
The name of the alias is called 'test'.
I tried using the Media Picker but I was getting the same results. No matter what I try I just can't get the URL into an image!I 'm also quite unsure how to get the pictures to be scaled to specific dimensions. If I could get some help that would be great.
-Mygel
Him you need to add the img tag, e,g.
It looks like you are using Umbraco 6 so if you want to use a media picker instead see this documentation for a code snippet (Mvc, dynamic)
Jeavon
Hi Mygel,
You can do it in two ways one way is by using a Partial Views, or antother way is by uing Partial View Macro. The code snippet you have to right is the same, the difference is the way you added the file to your template.
But if you want to get the image from the currentpage and you are using a media picker with alias of test, you could use the lines of code to get the image.
But if you want to use the code you already have the only thing you´re missing this the image tag, since you get the path to the image, as I see it from the links you are provide in your post.
So if you´re getting the image path by using is.
The try this:
Hope this helps,
/Dennis
is working on a reply...