将 Adob​​e Creative 编辑后的图像上传到我的服务器而不是他们的 Creative Cloud

Upload Adobe Creative Edited Image to my Server Instead of their Creative Cloud

我想将在 Adob​​e Creative SDK 图像编辑器中编辑过的图像上传到我自己的服务器。

图像编辑器 returns 我临时 URL 编辑图像。如何将编辑后的图片上传到我的服务器?

背景

默认情况下,Creative SDK 图像编辑器不会保存到 Creative Cloud。

有用于 iOS、Android 和 Web 的 Creative Cloud API,但在保存到 Creative Cloud 之前,您必须在代码中实际使用这些 API。

使用 onSave 属性

如您所见,Creative SDK Image Editor for Web returns Aviary.Feather() 配置对象 onSave 属性 中的临时 URL:

// Example Image Editor configuration
var csdkImageEditor = new Aviary.Feather({
    apiKey: '<YOUR_KEY_HERE>',
    onSave: function(imageID, newURL) {
        // Things to do when the image is saved
        currentImage.src = newURL;
        csdkImageEditor.close();
        console.log(newURL);
    },
    onError: function(errorObj) {
        // Things to do when there is an error saving
        console.log(errorObj.code);
        console.log(errorObj.message);
        console.log(errorObj.args);
    }
});

您可以在 onSave 功能中做任何您喜欢的事情,包括发布到您自己的服务器。只需将临时 newURL 发送到您的服务器并让服务器将图像保存到适当的位置。

发布和保存

如何从客户端发布和在服务器上保存将取决于您的堆栈。

最好根据您使用的堆栈在 Whosebug 中搜索与 "saving an image from a URL to a server" 相关的问题。举个例子,here is an answer related to server-side saving with PHP.

(您也可以从 my answer to a related question on saving the edited image 中受益。)