Wordpress Media Upload を使用して、サムネイル、サムネイル、ポスト サムネイルなどの特定の画像タイプを取得できないようです。
私が取得するのは画像の元のサイズの URL だけです。そのため、サムネイルや定義された画像サイズの代わりに巨大な画像を表示します。
これは私のスクリプトです:
jQuery("#submit_logo_button").click(function(e){
e.preventDefault();
var custom_file_frame;
if (typeof(custom_file_frame)!=="undefined") {
custom_file_frame.close();
}
//Create WP media frame.
custom_file_frame = wp.media.frames.customHeader = wp.media({
//Title of media manager frame
title: "Thumbs - Choose Logo",
library: {
type: 'image'
},
button: {
//Button text
text: "Select Logo"
},
size: "post-thumbnail",//shouldn't this work?!?
//Do not allow multiple files, if you want multiple, set true
multiple: false
});
//callback for selected image
custom_file_frame.on('select', function() {
var attachment = custom_file_frame.state().get('selection').first().toJSON();
jQuery("#image_thumbnail").attr("src", attachment.url);
});
//Open modal
custom_file_frame.open();
});
ありがとうございました :)