Kraken.io 图像大小调整


using Kraken;
using Kraken.Http;
using Kraken.Model;
public void ResizeSelectedImages()
{
var filesToResize = FilesInFolderListBox.SelectedItems;
var connection = Connection.Create(Properties.Settings.Default.krakenkey, Properties.Settings.Default.krakensecret, Properties.Settings.Default.SandBoxMode);
var client = new Client(connection);
foreach (var file in filesToResize)
{
var response = client.OptimizeWait(new Uri("http://awesome-website.com/images/header.png"),
new OptimizeUploadWaitRequest()
{
ResizeImage = new ResizeImage
{
Width = 100,
Height = 75,
Strategy = Strategy.Crop
}
}
);
}
}

我猜我试图做什么很明显,这几乎是从 kraken.io 文档中复制的代码。 不过,这给了我很多从"new OptimizeUploadWaitRequest(("开头的红线,说"参数2:从Kraken.Model.OptimizeUploadWaitRequest在System.Threading.CancelToken中转换是不可能的"......

到目前为止,Kraken 的其他方面正在工作(从我的本地目录中获取图像,"优化"它们并将它们上传到 FTP..不知何故,尽管这个不起作用......谷歌搜索都是关于某种至少有 6 只手臂的海洋生物......

有谁知道这个问题,可以帮助我?或者看看我做错了什么?..或者为我指出正确的方向。 我尝试重新安装软件包(URI 将是 file.toString((,但这无关紧要,并且在我从文档复制它之前已经给出了一个错误(

好的解决了我自己的问题..我刚刚接受了wronng任务..并且 kraken.io 网站上的文档有问题。

根据文档,你应该给它一个URI和optimizeUploadWaitRequest..而根据元数据,没有任何东西需要URI +和optimizeUploadWaitRequest..只有uri和cancelToken或文件路径和optimizeUploadWaitRequest..所以..是的..应该先看那里。

//public Task<IApiResponse<OptimizeResult>> Optimize(byte[] image, string filename, IOptimizeUploadRequest optimizeRequest, CancellationToken cancellationToken);
//public Task<IApiResponse<OptimizeResult>> Optimize(string filePath, IOptimizeSetUploadRequest optimizeRequest);
//public Task<IApiResponse<OptimizeResult>> Optimize(byte[] image, string filename, IOptimizeSetUploadRequest optimizeRequest, CancellationToken cancellationToken);
//public Task<IApiResponse<OptimizeResult>> Optimize(byte[] image, string filename, IOptimizeSetUploadRequest optimizeRequest);
//public Task<IApiResponse<OptimizeResult>> Optimize(IOptimizeSetRequest optimizeSetRequest, CancellationToken cancellationToken);
//public Task<IApiResponse<OptimizeResult>> Optimize(IOptimizeSetRequest optimizeSetRequest);
//public Task<IApiResponse<OptimizeResult>> Optimize(IOptimizeRequest optimizeRequest, CancellationToken cancellationToken);
//public Task<IApiResponse<OptimizeResult>> Optimize(IOptimizeRequest optimizeRequest);
//public Task<IApiResponse<OptimizeResult>> Optimize(string filePath, IOptimizeSetUploadRequest optimizeRequest, CancellationToken cancellationToken);
//public Task<IApiResponse<OptimizeResult>> Optimize(string filePath, IOptimizeUploadRequest optimizeRequest, CancellationToken cancellationToken);
//public Task<IApiResponse<OptimizeResult>> Optimize(string filePath, IOptimizeUploadRequest optimizeRequest);
//public Task<IApiResponse<OptimizeResult>> Optimize(byte[] image, string filename, IOptimizeUploadRequest optimizeRequest);
//public Task<IApiResponse<OptimizeResult>> Optimize(string filePath, Uri callbackUrl, CancellationToken cancellationToken);
//public Task<IApiResponse<OptimizeResult>> Optimize(string filePath, Uri callbackUrl);
//public Task<IApiResponse<OptimizeResult>> Optimize(Uri imageUri, Uri callbackUrl);
//public Task<IApiResponse<OptimizeResult>> Optimize(Uri imageUri, Uri callbackUrl, CancellationToken cancellationToken);
//public Task<IApiResponse<OptimizeWaitResult>> OptimizeWait(string filePath, IOptimizeUploadWaitRequest optimizeWaitRequest);
//public Task<IApiResponse<OptimizeWaitResult>> OptimizeWait(Uri imageUri);
public Task<IApiResponse<OptimizeWaitResult>> OptimizeWait(Uri imageUri, CancellationToken cancellationToken);
//public Task<IApiResponse<OptimizeSetWaitResults>> OptimizeWait(string filePath, IOptimizeSetUploadWaitRequest optimizeWaitRequest, CancellationToken cancellationToken);
//public Task<IApiResponse<OptimizeSetWaitResults>> OptimizeWait(string filePath, IOptimizeSetUploadWaitRequest optimizeWaitRequest);
//public Task<IApiResponse<OptimizeSetWaitResults>> OptimizeWait(byte[] image, string filename, IOptimizeSetUploadWaitRequest optimizeWaitRequest, CancellationToken cancellationToken);
//public Task<IApiResponse<OptimizeSetWaitResults>> OptimizeWait(byte[] image, string filename, IOptimizeSetUploadWaitRequest optimizeWaitRequest);
//public Task<IApiResponse<OptimizeSetWaitResults>> OptimizeWait(IOptimizeSetWaitRequest optimizeSetWaitRequest, CancellationToken cancellationToken);
//public Task<IApiResponse<OptimizeSetWaitResults>> OptimizeWait(IOptimizeSetWaitRequest optimizeSetWaitRequest);
//public Task<IApiResponse<OptimizeWaitResult>> OptimizeWait(string filePath);
//public Task<IApiResponse<OptimizeWaitResult>> OptimizeWait(string filePath, CancellationToken cancellationToken);
//public Task<IApiResponse<OptimizeWaitResult>> OptimizeWait(IOptimizeWaitRequest optimizeWaitRequest, CancellationToken cancellationToken);
//public Task<IApiResponse<OptimizeWaitResult>> OptimizeWait(IOptimizeWaitRequest optimizeWaitRequest);
//public Task<IApiResponse<OptimizeWaitResult>> OptimizeWait(byte[] image, string filename, IOptimizeUploadWaitRequest optimizeWaitRequest, CancellationToken cancellationToken);
//public Task<IApiResponse<OptimizeWaitResult>> OptimizeWait(byte[] image, string filename, IOptimizeUploadWaitRequest optimizeWaitRequest);
public Task<IApiResponse<OptimizeWaitResult>> OptimizeWait(string filePath, IOptimizeUploadWaitRequest optimizeWaitRequest, CancellationToken cancellationToken);
//public Task<IApiResponse<UserResult>> UserStatus(CancellationToken cancellationToken);
//public Task<IApiResponse<UserResult>> UserStatus();

病得这么重,只需要把合适的人带出去 (为了清楚起见,这两个条目没有注释掉......我希望(

所以是的..和Kraken一样好似乎有效..文档..不是最新的。

相关内容

  • 没有找到相关文章

最新更新