Open Shazwazza opened 9 years ago
have you find a workaround Shannon, doing media ezsearch with file upload replaced as cropper?
I haven't tried anything, if ezsearch get's updated that would be the best fix, would be pretty simple really.
Otherwise you can try to add your own indexing handler just like ez search does and parse the value properly.
any pointers or quick fix you can share for changing the part to support cropper default data type? I am not sure how to update to code to support the json parsing accordingly...
// Extract the filename from media items if(e.Fields.ContainsKey("umbracoFile")) { e.Fields["umbracoFileName"] = Path.GetFileName(e.Fields["umbracoFile"]); }
This will support the imagecropdataset... not sure if there is any other way to detect if JSON exists rather than the URL.
if (e.Fields.ContainsKey(StaticValues.Properties.UmbracoFile))
{
try
{
var imageCrop = JsonConvert.DeserializeObject
This may be considered a bit hacky, but a quick fix would be to extract the filename using regex
if (e.Fields.ContainsKey("umbracoFile")) { var match = Regex.Match(e.Fields["umbracoFile"], @"(\/media.*?.(jpg|png|gif|jpeg|svg))"); if (match.Success) { e.Fields["umbracoFileName"] = match.Value; } }
of course this depends on specific media types, and it doesn't check if the image cropper or upload field has been used
t
It's because of this code here:
in the ezSearchBoostrapper class
If you change the file upload on a media item to be a cropper, then the umbracoFile value is Json and this throws a ysod.