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,
How do I get the Image Cropper working with Archetype? I am using this to get the URL the old way but need a way to get the Image Cropper:
@Umbraco.Media(fieldset.GetValue("blockImage"))
Im using Umbraco 7.4.3.
Jon
Hi Jon
This thread my shed some light on it - https://github.com/kgiszewski/Archetype/issues/255
I found a work around...
The crop data is stored as json inside the Archetype so you can extract it then re-create the url using the data.
@inherits Umbraco.Web.Macros.PartialViewMacroPage @using Archetype.Models; @using Archetype.Extensions; @using Newtonsoft.Json.Linq; @{ foreach (var itm in CurrentPage.GetPropertyValue<ArchetypeModel>("moreImages")) { string[] c = { "0", "0", "0", "0" }; string src; JObject o = JObject.Parse(itm.GetValue("additionalImage")); // SOURCE src = o["src"].ToString() + "?crop="; // CROPS - I needed the 5th crop but you can adapt... if (o["crops"][5]["coordinates"] != null) { c[0] = o["crops"][5]["coordinates"]["x1"].ToString(); c[1] = o["crops"][5]["coordinates"]["y1"].ToString(); c[2] = o["crops"][5]["coordinates"]["x2"].ToString(); c[3] = o["crops"][5]["coordinates"]["y2"].ToString(); } for (int a = 0; a < c.Length; a++) { src = src + c[a] + ","; } src = src.TrimEnd(",") + "&cropmode=percentage&width=600&height=600"; <img class="content-page-image" src="@src" alt="@itm.GetValue("imageTitle")"/> } }
Its not the cleanest or tidiest way of doing things, but it worked for me!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Archetype using Image Cropper
Hi,
How do I get the Image Cropper working with Archetype? I am using this to get the URL the old way but need a way to get the Image Cropper:
@Umbraco.Media(fieldset.GetValue("blockImage"))
Im using Umbraco 7.4.3.
Jon
Hi Jon
This thread my shed some light on it - https://github.com/kgiszewski/Archetype/issues/255
I found a work around...
The crop data is stored as json inside the Archetype so you can extract it then re-create the url using the data.
Its not the cleanest or tidiest way of doing things, but it worked for me!
is working on a reply...