Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi guys, I´m new in Umbraco and I´m having problems with getting a imagem from Extended Media Picker. Here is the code that I´m using:
@foreach (var project in listOfProjects) { var projectImage= Umbraco.Media(project .imageProject); <img class="img-responsive" src="@projectImage.umbracofile" alt="thumb" /> }
The code it´s returning me a json in the src atribute.
Anyone knows how to solve this problem?
Best Regards
Hi Vanilson and welcome to our :)
Try to use this code below, as you can see I have removed the spacing between project .imageProject and added uppercase F in umbracoFile.
@foreach (var project in listOfProjects) { var projectImage = Umbraco.Media(project.imageProject); <img class="img-responsive" src="@projectImage.umbracoFile" alt="thumb" /> }
Hope this helps,
/Dennis
Hi Dennis, thank you for the reply. I make the changes and still not working.
Hi Vanilson,
When you are saying that you are using Extended Media Picker then we are talking about this package https://our.umbraco.org/projects/backoffice-extensions/extended-media-picker/ ?
Have you checked that you are using the right properyAlias from the document type, and the node has a picture assigned.
If you could share you full code then I think, it easier to help, or perhaps some screenshots of your content structure.
Okay I have tested a bit more when you have more than one image added to the picker, there was a problem.
But you can solve this by using and customize the code that you can find here so it match your case
https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/media-picker
@foreach (var project in listOfProjects){ var projectImagesList = project.projectImage.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); var projectImagesCollection = Umbraco.Media(projectImagesList); foreach (var peojctImageImage in projectImagesCollection){ <img class="img-responsive" src="@peojctImageImage.Url" alt="thub"/> } }
I have updated the code snippet so it should work with your setup
Hi Dennis, it works, I just changed this line:
var projectImagesList = project.projectImage.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
to this:
var projectImagesList = project.projectImage.ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
Thank you and best regards
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Getting a Image from Extended Media Picker
Hi guys, I´m new in Umbraco and I´m having problems with getting a imagem from Extended Media Picker. Here is the code that I´m using:
The code it´s returning me a json in the src atribute.
Anyone knows how to solve this problem?
Best Regards
Hi Vanilson and welcome to our :)
Try to use this code below, as you can see I have removed the spacing between project .imageProject and added uppercase F in umbracoFile.
Hope this helps,
/Dennis
Hi Dennis, thank you for the reply. I make the changes and still not working.
Best Regards
Hi Vanilson,
When you are saying that you are using Extended Media Picker then we are talking about this package https://our.umbraco.org/projects/backoffice-extensions/extended-media-picker/ ?
Have you checked that you are using the right properyAlias from the document type, and the node has a picture assigned.
If you could share you full code then I think, it easier to help, or perhaps some screenshots of your content structure.
/Dennis
Hi Vanilson,
Okay I have tested a bit more when you have more than one image added to the picker, there was a problem.
But you can solve this by using and customize the code that you can find here so it match your case
https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/media-picker
I have updated the code snippet so it should work with your setup
Hope this helps,
/Dennis
Hi Dennis, it works, I just changed this line:
to this:
Thank you and best regards
is working on a reply...