I try to grab images from a folder using Media Picker and Image cropper, I have saved images again after I changed the upload to Image cropper. it's all from a Macro, and the Macro is not at the same level as the Document Type that is referring to the media folder.
structure:
Document Type with Media Picker property (images) must refer to a media folder, and not a single image.
Media Type with Image cropper property (umbracoFile)
As Jan has said, you need to use a MVC View (template), Partial View or a Partial View Macro.
Generally you only need to use Views and Partial Views, Partial View Macros are mainly designed to be used when you need to select Macro in a RTE or you are using WebForms templates instead of MVC for some other reason (e.g. existing UserControl based code base)
Scripting File Macro's are only in v7 for legacy support and should not be used except for upgraded websites.
MVC templating documentation is here and documentation on Partial View Macros is here
Image cropper and Media Picker
Hey
I try to grab images from a folder using Media Picker and Image cropper, I have saved images again after I changed the upload to Image cropper. it's all from a Macro, and the Macro is not at the same level as the Document Type that is referring to the media folder.
structure:
Document Type with Media Picker property (images) must refer to a media folder, and not a single image.
Media Type with Image cropper property (umbracoFile)
@inherits umbraco.MacroEngines.DynamicNodeContext @foreach (var item in Model.Children) { <h1>@item.images</h1> foreach (var crop in Library.MediaById(item.images).Children) { <p>1: @crop</p> <p>2: @crop.Name</p> <p>3: @crop.Url </p> <p>4: @crop.umbracoFile </p> <p>5: @crop.src </p> <p>6: @crop.GetCropUrl("Url", "thumb")</p> <p>7: @crop.GetCropUrl("umbracoFile", "thumb")</p> }
1: umbraco.MacroEngines.DynamicNode
2: WP_000110.jpg
3: { "focalPoint": { "left": 0.5, "top": 0.5 }, "src": "/media/1005/wp_000110.jpg", "crops": [ { "alias": "thumb", "width": 220, "height": 220 } ] }
4: { "focalPoint": { "left": 0.5, "top": 0.5 }, "src": "/media/1005/wp_000110.jpg", "crops": [ { "alias": "thumb", "width": 220, "height": 220 } ] }
5:
6:
7:
But I can not get it to work. Hope you see what I'm doing wrong.
Hi Johan
I'm asuming you're running Umbraco 7.1 final.
Have you tried having a look in the documentation on the new media cropper ? Image cropper
Hope this helps.
/Jan
yes I did, has it something to do with that it is a Macro? I've tried everything I can think of.
Hi Johan
What type of macro have you created? Is it a scripting file macro or a partial view macro?
/Jan
scripting file macro in a template.
Hi Johan
Ok, could you try just writing it in directly in the template? Or in a partial view macro?
/Jan
Hi Johan,
As Jan has said, you need to use a MVC View (template), Partial View or a Partial View Macro.
Generally you only need to use Views and Partial Views, Partial View Macros are mainly designed to be used when you need to select Macro in a RTE or you are using WebForms templates instead of MVC for some other reason (e.g. existing UserControl based code base)
Scripting File Macro's are only in v7 for legacy support and should not be used except for upgraded websites.
MVC templating documentation is here and documentation on Partial View Macros is here
Hope that's helpful.
Jeavon
Yes it works in razor template (of course) - so Thanks Jan.
And I did not know not to use Scripting File Macro. I will look into Partial View. Thanks Jeavon
is working on a reply...