2015-07-04 3 views
0

Как конвертировать загруженное изображение в миниатюру размером 125x166 пикселей?Wordpress Image Uploader As Thumbnail

// jQuery 
wp_enqueue_script('jquery'); 

// This will enqueue the Media Uploader script 
wp_enqueue_media(); 

var image = wp.media({ 
        title: 'Upload Image', 
        multiple: false 
       }).open() 
        .on('select', function (e) { 
         // This will return the selected image from the Media Uploader, the result is an object 
         var uploaded_image = image.state().get('selection').first(); 
         // We convert uploaded_image to a JSON object to make accessing it easier 
         // Output to the console uploaded_image 
         console.log(uploaded_image); 
         var image_url = uploaded_image.toJSON().url; 

        }); 
      }); 

ответ