我在我的新Wordpress插件开发中使用这个功能,这工作正常,使用Wordpress Media Uploader进行图像上传,但是我需要使用预定义的裁剪功能在上传后裁剪图像,我不知道该怎么做.
function wilson_newsletter_media_library(big_parent){
var frame_uploader, datos_imagen;
if ( undefined !== frame_uploader ) {
frame_uploader.open();
return;
}
frame_uploader = wp.media.frames.frame_uploader = wp.media({
title: "Insert Media",
button: {
text: "Aceptar"
},
multiple: false
});
frame_uploader.on( 'select', function() {
datos_imagen = frame_uploader.state().get( 'selection' ).first().toJSON();
big_parent.children('img').attr("src", datos_imagen.url);
});
frame_uploader.open();
}
我真的很感谢任何帮助。
最佳答案
我在 WordPress Stack Exchange 网站上发布了一个可能的解决方案,该解决方案展示了如何使用主题选项页面中的媒体库选择和裁剪图像: https://wordpress.stackexchange.com/questions/281760/using-media-uploader-to-select-image-of-specific-size-enforce-cropper/302962#302962
关于javascript - 使用 wp.media 裁剪图像的 WordPress 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48082713/