Umbraco:通过 SurfaceController 获取 ImageCropper 和文件上传

Umbraco: Get ImageCropper & File Upload via SurfaceController

我还是 Umbraco 7 的新手,但我已经找到了使用 Surface 控制器的方法。

我创建了一个 SurfaceController,您可以在下面看到它的未来。但是我不知道如何从图像裁剪器和文件上传中获取 URL,我通常会这样做:@node.GetCropUrl("uploadImage, "thumbnail");

但这在控制器内部不起作用。我如何实现这一目标?我的最终目标是在单击此页面上的类别时在 IMG 标签中显示 URL:描述区域中的 http://sp34k.dk/portfolio/vue/

代码:

https://jsfiddle.net/odg3zamx/7/

GetCropUrlIPublishedContent 的扩展方法,因此只需在表面控制器中添加 using Umbraco.Web; 即可调用它。像这样:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Umbraco.Web.Mvc;
using Umbraco.Web;  //you are missing this namespace

public class PortfolioSurfaceController : SurfaceController
{
    // GET: PortfolioSurface
    public ActionResult GetCategoryDetails(int id)
    {
        GalleryItem gItem = new GalleryItem();
        var node = Umbraco.TypedContent(id);
        gItem.imgUrl = node.GetCropUrl("uploadImage", "featured");

        return Json(gItem, JsonRequestBehavior.AllowGet);
    }
}