gpt4 book ai didi

javascript - 如何在 HTML 应用程序中集成 Shutterstock 图像编辑器?

转载 作者:行者123 更新时间:2023-12-03 02:21:39 25 4
gpt4 key购买 nike

我想将 Shutterstock 图像编辑器集成到我的简单 HTML 应用程序中。因此,我在 Shutterstock 中创建了一个开发者帐户并创建了我的 API key 。下面是我的 API:

enter image description here

现在我在 HTML 中使用上述 API key (消费者 key ),如描述 here 。下面是我的 HTML 文件代码:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>

</head>
<body>


<script src="https://s.picdn.net/editor/image/assets/integration.js"></script>
<script>
window.editorInstance = window.Editor({
apiKey: 'e1818-c5e61-74ce1-7ee31-6c7f8-7fb6d',
language: 'en',
image: 'https://www2.shutterstock.com/blog/wp-content/uploads/sites/5/2015/05/volcano-header-1440x960.jpg',
excludeFeatures: ['filters'],
initialPanel: 'text',
logo: true,
logoUrl: 'https://www2.shutterstock.com/base/public/images/logos/logo-shutterstock-de64a370ef.png',
primaryActionText: 'Save and close',
container: document.querySelector('#editor'),
canvas: {
height: 500,
width: 500,
fill: 'rgb(62, 69, 79)'
},
presets: [{
name: 'Icon',
height: 128,
width: 128
}, {
name: 'Book Cover',
height: 1600,
width: 2400
}],
onPrimaryAction: function() {
window.editorInstance.getBase64({
format: 'jpg',
quality: .91
}).then(function(base64) {
// Handle base64 image data
window.editorInstance.hide();
});
}
});

// Launch instance of Editor
window.editorInstance.launch().then(function(editor) {
// Actions
}).catch(function(err) {
// Handle error
});
</script>

运行上面的 HTML 页面编辑器后,无法呈现。下面是我的控制台日志显示:

Failed to load resource: the server responded with a status of 403 (Forbidden)

并且显示下面的屏幕。

enter image description here

我还访问Fiddle在 HTML 中集成编辑器,但此 API 使用 JSFiddle 客户端。我的问题是如何在 HTML 应用程序中实现 Shutterstock 照片编辑器。请让我知道我在上面的代码中做错了什么。

最佳答案

您需要联系 api [at]shutterstock.com 才能访问编辑器 - 他们需要手动启用您的 api key 。

关于javascript - 如何在 HTML 应用程序中集成 Shutterstock 图像编辑器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49132528/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com