如何从 Zemanta 捕获缩略图链接?
我的 Zemanta 控件通过 TinyMCE 在我的本地 CMS 上运行,但我还想将图像保存到我的服务器,以便我可以制作它们的缩略图以在文章之外进行预览。我不确定如何最好地实现这一点。
我的想法是,除了内容 text_area 之外,还有一个隐藏字段,可以仅捕获来自 Zemanta 的图像链接并在保存时下载它们。我不确定如何使用通用 JavaScript 来完成此操作,如下所示:
我想将其扔给 #editor-images
,这也是我只接收图像链接本身而不接收图像链接的问题HTML 标记。有什么想法吗?
get_editor: function () {
var elm = null, win = null, editor = {element: null, property: null, type: null, win: null};
try {
elm = $('#editor-textarea_ifr').get(0);
if (elm && elm.contentWindow) {
win = elm.contentWindow;
elm = null;
} else {
elm = $('#editor-textarea_ifr').get(0);
}
editor = win && {element: win.document.body, property: 'innerHTML', type: 'RTE', win: win} ||
elm && {element: elm, property: 'value', type: elm.tagName.toLowerCase(), win: null} ||
editor;
} catch (er) {
$.zemanta.log(er);
}
return editor;
}
I have Zemanta's controls working on my local CMS with TinyMCE, but I'd like to also save the images to my server so I can make thumbnails of them for previews outside the article. I am not sure how best to accomplish this.
My idea is in addition to the content text_area to have a hidden field which can capture just the image links from Zemanta and download them on save. I'm unsure how to accomplish this with their generic JavaScript as below:
I'd like to throw it to #editor-images
, also is the problem I have of only receiving the image links themselves without the HTML markup. Any ideas?
get_editor: function () {
var elm = null, win = null, editor = {element: null, property: null, type: null, win: null};
try {
elm = $('#editor-textarea_ifr').get(0);
if (elm && elm.contentWindow) {
win = elm.contentWindow;
elm = null;
} else {
elm = $('#editor-textarea_ifr').get(0);
}
editor = win && {element: win.document.body, property: 'innerHTML', type: 'RTE', win: win} ||
elm && {element: elm, property: 'value', type: elm.tagName.toLowerCase(), win: null} ||
editor;
} catch (er) {
$.zemanta.log(er);
}
return editor;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论