本文整理汇总了PHP中wp_image_editor_supports函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_image_editor_supports函数的具体用法?PHP wp_image_editor_supports怎么用?PHP wp_image_editor_supports使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_image_editor_supports函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkEditorSupport
/**
* Returns whether or not their is image editor support.
*
* @todo Nonfunctional method needs completed.
*
* @access public
* @since 8.1
* @static
*
* @return bool|void
*/
public static function checkEditorSupport()
{
if (!is_admin()) {
return;
}
$atts = array('mime_type' => 'image/jpeg');
if (wp_image_editor_supports($atts) !== TRUE) {
cnMessage::create('error', 'image_edit_support_failed');
}
return TRUE;
}
示例2: resize_crop_selection
/**
* Resize/Crop Selection
*
* @since 1.3.0
*
* @return boolean
*/
public function resize_crop_selection($args = array())
{
extract($_POST);
extract($args);
global $wp_version;
$thumb_offset = $orig_h / $final_h;
$thumb_h = $orig_h / $thumb_offset;
$thumb_w = $orig_w / $thumb_offset;
$src_w = $final_w;
$mime_type = get_post_mime_type($id);
$editor_supports_args = array('mime_type' => $mime_type, 'methods' => array('crop', 'resize', 'save'));
$img_editor_test = wp_image_editor_supports($editor_supports_args);
if (floatval($wp_version) >= 3.5 and $img_editor_test !== false) {
$upload_dir = wp_upload_dir();
extract($upload_dir);
$pathinfo = pathinfo($src);
extract($pathinfo);
// Make an URI out of an URL
$img_src_uri = trailingslashit($basedir) . str_replace($baseurl, '', $src);
// Make an Directory URI out of an URL
$img_dir_uri = str_replace($basename, '', $img_src_uri);
// Image Edit
$img = wp_get_image_editor($img_src_uri);
if (!is_wp_error($img)) {
$resize = $img->resize($thumb_w, $thumb_h, false);
$crop = $img->crop($src_x, $src_y, $src_w, $src_h, NULL, NULL, false);
$filename = $img->generate_filename($img->get_suffix(), $img_dir_uri, $extension);
$saved = $img->save();
if (!is_wp_error($saved)) {
return true;
} else {
return false;
}
// if/else()
}
// if()
return false;
}
}
示例3: dynimg_404_handler
function dynimg_404_handler()
{
if (!is_404()) {
return;
}
// Has the file name the proper format for this handler?
if (!preg_match('/(.*)-([0-9]+)x([0-9]+)(c)?\\.(\\w+)($|\\?|#)/i', $_SERVER['REQUEST_URI'], $matches)) {
return;
}
$mime_types = wp_get_mime_types();
$img_ext = $matches[5];
$ext_known = false;
// The extensions for some MIME types are set as regular expression (PCRE).
foreach ($mime_types as $rgx_ext => $mime_type) {
if (preg_match("/{$rgx_ext}/i", $img_ext)) {
if (wp_image_editor_supports(array('mime_type' => $mime_type))) {
$ext_known = true;
break;
}
}
}
if (!$ext_known) {
return;
}
$filename = urldecode($matches[1] . '.' . $img_ext);
$width = $matches[2];
$height = $matches[3];
$crop = !empty($matches[4]);
$uploads_dir = wp_upload_dir();
$temp = parse_url($uploads_dir['baseurl']);
$upload_path = $temp['path'];
$findfile = str_replace($upload_path, '', $filename);
$basefile = $uploads_dir['basedir'] . $findfile;
// Serve the image this one time (next time the webserver will do it for us)
dynimg_create_save_stream($basefile, $width, $height, $crop);
}
示例4: edit_form_image_editor
/**
* Displays the image and editor in the post editor
*
* @since 3.5.0
*/
function edit_form_image_editor($post)
{
$open = isset($_GET['image-editor']);
if ($open) {
require_once ABSPATH . 'wp-admin/includes/image-edit.php';
}
$thumb_url = false;
if ($attachment_id = intval($post->ID)) {
$thumb_url = wp_get_attachment_image_src($attachment_id, array(900, 450), true);
}
$alt_text = get_post_meta($post->ID, '_wp_attachment_image_alt', true);
$att_url = wp_get_attachment_url($post->ID);
?>
<div class="wp_attachment_holder">
<?php
if (wp_attachment_is_image($post->ID)) {
$image_edit_button = '';
if (wp_image_editor_supports(array('mime_type' => $post->post_mime_type))) {
$nonce = wp_create_nonce("image_editor-{$post->ID}");
$image_edit_button = "<input type='button' id='imgedit-open-btn-{$post->ID}' onclick='imageEdit.open( {$post->ID}, \"{$nonce}\" )' class='button' value='" . esc_attr__('Edit Image') . "' /> <span class='spinner'></span>";
}
?>
<div class="imgedit-response" id="imgedit-response-<?php
echo $attachment_id;
?>
"></div>
<div<?php
if ($open) {
echo ' style="display:none"';
}
?>
class="wp_attachment_image" id="media-head-<?php
echo $attachment_id;
?>
">
<p id="thumbnail-head-<?php
echo $attachment_id;
?>
"><img class="thumbnail" src="<?php
echo set_url_scheme($thumb_url[0]);
?>
" style="max-width:100%" alt="" /></p>
<p><?php
echo $image_edit_button;
?>
</p>
</div>
<div<?php
if (!$open) {
echo ' style="display:none"';
}
?>
class="image-editor" id="image-editor-<?php
echo $attachment_id;
?>
">
<?php
if ($open) {
wp_image_editor($attachment_id);
}
?>
</div>
<?php
} elseif ($attachment_id && 0 === strpos($post->post_mime_type, 'audio/')) {
wp_maybe_generate_attachment_metadata($post);
echo wp_audio_shortcode(array('src' => $att_url));
} elseif ($attachment_id && 0 === strpos($post->post_mime_type, 'video/')) {
wp_maybe_generate_attachment_metadata($post);
$meta = wp_get_attachment_metadata($attachment_id);
$w = !empty($meta['width']) ? min($meta['width'], 640) : 0;
$h = !empty($meta['height']) ? $meta['height'] : 0;
if ($h && $w < $meta['width']) {
$h = round($meta['height'] * $w / $meta['width']);
}
$attr = array('src' => $att_url);
if (!empty($w) && !empty($h)) {
$attr['width'] = $w;
$attr['height'] = $h;
}
$thumb_id = get_post_thumbnail_id($attachment_id);
if (!empty($thumb_id)) {
$attr['poster'] = wp_get_attachment_url($thumb_id);
}
echo wp_video_shortcode($attr);
}
?>
</div>
<div class="wp_attachment_details edit-form-section">
<p>
<label for="attachment_caption"><strong><?php
_e('Caption');
?>
</strong></label><br />
//.........这里部分代码省略.........
示例5: wp_image_editor
//.........这里部分代码省略.........
</label>
<label class="imgedit-label">
<input type="radio" name="imgedit-target-<?php
echo $post_id;
?>
" value="nothumb" />
<?php
_e('All sizes except thumbnail');
?>
</label>
</p>
</div>
<?php
}
?>
</div>
<div class="imgedit-panel-content">
<?php
echo $note;
?>
<div class="imgedit-menu">
<div onclick="imageEdit.crop(<?php
echo "{$post_id}, '{$nonce}'";
?>
, this)" class="imgedit-crop disabled" title="<?php
esc_attr_e('Crop');
?>
"></div><?php
// On some setups GD library does not provide imagerotate() - Ticket #11536
if (wp_image_editor_supports(array('mime_type' => get_post_mime_type($post_id), 'methods' => array('rotate')))) {
?>
<div class="imgedit-rleft" onclick="imageEdit.rotate( 90, <?php
echo "{$post_id}, '{$nonce}'";
?>
, this)" title="<?php
esc_attr_e('Rotate counter-clockwise');
?>
"></div>
<div class="imgedit-rright" onclick="imageEdit.rotate(-90, <?php
echo "{$post_id}, '{$nonce}'";
?>
, this)" title="<?php
esc_attr_e('Rotate clockwise');
?>
"></div>
<?php
} else {
$note_no_rotate = esc_attr__('Image rotation is not supported by your web host.');
?>
<div class="imgedit-rleft disabled" title="<?php
echo $note_no_rotate;
?>
"></div>
<div class="imgedit-rright disabled" title="<?php
echo $note_no_rotate;
?>
"></div>
<?php
}
?>
<div onclick="imageEdit.flip(1, <?php
示例6: edit_form_image_editor
/**
* Displays the image and editor in the post editor
*
* @since 3.5.0
*/
function edit_form_image_editor()
{
$post = get_post();
$thumb_url = false;
if ($attachment_id = intval($post->ID)) {
$thumb_url = wp_get_attachment_image_src($attachment_id, array(900, 600), true);
}
$filename = esc_html(basename($post->guid));
$title = esc_attr($post->post_title);
$alt_text = get_post_meta($post->ID, '_wp_attachment_image_alt', true);
$media_dims = '';
$meta = wp_get_attachment_metadata($post->ID);
if (is_array($meta) && array_key_exists('width', $meta) && array_key_exists('height', $meta)) {
$media_dims .= "<span id='media-dims-{$post->ID}'>{$meta['width']} × {$meta['height']}</span> ";
}
$media_dims = apply_filters('media_meta', $media_dims, $post);
$att_url = wp_get_attachment_url($post->ID);
$image_edit_button = '';
if (wp_image_editor_supports(array('mime_type' => $post->post_mime_type))) {
$nonce = wp_create_nonce("image_editor-{$post->ID}");
$image_edit_button = "<input type='button' id='imgedit-open-btn-{$post->ID}' onclick='imageEdit.open( {$post->ID}, \"{$nonce}\" )' class='button' value='" . esc_attr__('Edit Image') . "' /> <span class='spinner'></span>";
}
?>
<div class="wp_attachment_holder">
<div class="imgedit-response" id="imgedit-response-<?php
echo $attachment_id;
?>
"></div>
<div class="wp_attachment_image" id="media-head-<?php
echo $attachment_id;
?>
">
<p id="thumbnail-head-<?php
echo $attachment_id;
?>
"><img class="thumbnail" src="<?php
echo set_url_scheme($thumb_url[0]);
?>
" style="max-width:100%" alt="" /></p>
<p><?php
echo $image_edit_button;
?>
</p>
</div>
<div style="display:none" class="image-editor" id="image-editor-<?php
echo $attachment_id;
?>
"></div>
</div>
<div class="wp_attachment_details">
<p>
<label for="attachment_caption"><strong><?php
_e('Caption');
?>
</strong></label><br />
<textarea class="widefat" name="excerpt" id="attachment_caption"><?php
echo $post->post_excerpt;
?>
</textarea>
</p>
<?php
if ('image' === substr($post->post_mime_type, 0, 5)) {
?>
<p>
<label for="attachment_alt"><strong><?php
_e('Alternative Text');
?>
</strong></label><br />
<input type="text" class="widefat" name="_wp_attachment_image_alt" id="attachment_alt" value="<?php
echo esc_attr($alt_text);
?>
" />
</p>
<?php
}
?>
</div>
<?php
$extras = get_compat_media_markup($post->ID);
echo $extras['item'];
foreach ($extras['hidden'] as $hidden_field => $value) {
echo '<input type="hidden" name="' . esc_attr($hidden_field) . '" value="' . esc_attr($value) . '" />' . "\n";
}
echo '<input type="hidden" id="image-edit-context" value="edit-attachment" />' . "\n";
}
示例7: wp_update_attachment_metadata
wp_update_attachment_metadata($id, $metadata);
WP_CLI::log("Regenerated thumbnails for {$att_desc}");
}
private function remove_old_images($att_id)
{
$wud = wp_upload_dir();
$metadata = wp_get_attachment_metadata($att_id);
if (empty($metadata['file'])) {
return;
}
$dir_path = $wud['basedir'] . '/' . dirname($metadata['file']) . '/';
$original_path = $dir_path . basename($metadata['file']);
if (empty($metadata['sizes'])) {
return;
}
foreach ($metadata['sizes'] as $size_info) {
$intermediate_path = $dir_path . $size_info['file'];
if ($intermediate_path == $original_path) {
continue;
}
if (file_exists($intermediate_path)) {
unlink($intermediate_path);
}
}
}
}
WP_CLI::add_command('media', 'Media_Command', array('before_invoke' => function () {
if (!wp_image_editor_supports()) {
WP_CLI::error('No support for generating images found. ' . 'Please install the Imagick or GD PHP extensions.');
}
}));
示例8: _is_image_editor_supports
private function _is_image_editor_supports()
{
$arg = ['mime_type' => 'image/jpeg'];
return wp_image_editor_supports($arg);
}
示例9: wp_image_editor
/**
* WordPress Image Editor
*
* @package WordPress
* @subpackage Administration
*/
function wp_image_editor($post_id, $msg = false)
{
$nonce = wp_create_nonce("image_editor-{$post_id}");
$meta = wp_get_attachment_metadata($post_id);
$thumb = image_get_intermediate_size($post_id, 'thumbnail');
$sub_sizes = isset($meta['sizes']) && is_array($meta['sizes']);
$note = '';
if (is_array($meta) && isset($meta['width'])) {
$big = max($meta['width'], $meta['height']);
} else {
die(__('Image data does not exist. Please re-upload the image.'));
}
$sizer = $big > 400 ? 400 / $big : 1;
$backup_sizes = get_post_meta($post_id, '_wp_attachment_backup_sizes', true);
$can_restore = !empty($backup_sizes) && isset($backup_sizes['full-orig']) && $backup_sizes['full-orig']['file'] != basename($meta['file']);
if ($msg) {
if (isset($msg->error)) {
$note = "<div class='error'><p>{$msg->error}</p></div>";
} elseif (isset($msg->msg)) {
$note = "<div class='updated'><p>{$msg->msg}</p></div>";
}
}
?>
<div class="imgedit-wrap">
<?php
echo $note;
?>
<table id="imgedit-panel-<?php
echo $post_id;
?>
"><tbody>
<tr><td>
<div class="imgedit-menu">
<div onclick="imageEdit.crop(<?php
echo "{$post_id}, '{$nonce}'";
?>
, this)" class="imgedit-crop disabled" title="<?php
esc_attr_e('Crop');
?>
"></div><?php
// On some setups GD library does not provide imagerotate() - Ticket #11536
if (wp_image_editor_supports(array('mime_type' => get_post_mime_type($post_id), 'methods' => array('rotate')))) {
?>
<div class="imgedit-rleft" onclick="imageEdit.rotate( 90, <?php
echo "{$post_id}, '{$nonce}'";
?>
, this)" title="<?php
esc_attr_e('Rotate counter-clockwise');
?>
"></div>
<div class="imgedit-rright" onclick="imageEdit.rotate(-90, <?php
echo "{$post_id}, '{$nonce}'";
?>
, this)" title="<?php
esc_attr_e('Rotate clockwise');
?>
"></div>
<?php
} else {
$note_no_rotate = esc_attr__('Image rotation is not supported by your web host.');
?>
<div class="imgedit-rleft disabled" title="<?php
echo $note_no_rotate;
?>
"></div>
<div class="imgedit-rright disabled" title="<?php
echo $note_no_rotate;
?>
"></div>
<?php
}
?>
<div onclick="imageEdit.flip(1, <?php
echo "{$post_id}, '{$nonce}'";
?>
, this)" class="imgedit-flipv" title="<?php
esc_attr_e('Flip vertically');
?>
"></div>
<div onclick="imageEdit.flip(2, <?php
echo "{$post_id}, '{$nonce}'";
?>
, this)" class="imgedit-fliph" title="<?php
esc_attr_e('Flip horizontally');
?>
"></div>
<div id="image-undo-<?php
echo $post_id;
?>
" onclick="imageEdit.undo(<?php
echo "{$post_id}, '{$nonce}'";
?>
//.........这里部分代码省略.........
示例10: test_fallback_intermediate_image_sizes
/**
* @ticket 39231
*/
public function test_fallback_intermediate_image_sizes()
{
if (!wp_image_editor_supports(array('mime_type' => 'application/pdf'))) {
$this->markTestSkipped('Rendering PDFs is not supported on this system.');
}
$orig_file = DIR_TESTDATA . '/images/wordpress-gsoc-flyer.pdf';
$test_file = '/tmp/wordpress-gsoc-flyer.pdf';
copy($orig_file, $test_file);
$attachment_id = $this->factory->attachment->create_object($test_file, 0, array('post_mime_type' => 'application/pdf'));
$this->assertNotEmpty($attachment_id);
add_image_size('test-size', 100, 100);
add_filter('fallback_intermediate_image_sizes', array($this, 'filter_fallback_intermediate_image_sizes'), 10, 2);
$expected = array('file' => 'wordpress-gsoc-flyer-77x100.jpg', 'width' => 77, 'height' => 100, 'mime-type' => 'image/jpeg');
$metadata = wp_generate_attachment_metadata($attachment_id, $test_file);
$this->assertTrue(isset($metadata['sizes']['test-size']), 'The `test-size` was not added to the metadata.');
$this->assertSame($metadata['sizes']['test-size'], $expected);
remove_image_size('test-size');
remove_filter('fallback_intermediate_image_sizes', array($this, 'filter_fallback_intermediate_image_sizes'), 10);
unlink($test_file);
}
示例11: bfi_wp_image_editor_check
function bfi_wp_image_editor_check()
{
$arg = array('mime_type' => 'image/jpeg');
if (wp_image_editor_supports($arg) !== true) {
add_filter('admin_notices', 'bfi_wp_image_editor_check_notice');
}
}
示例12: edit_form_image_editor
/**
* Displays the image and editor in the post editor
*
* @since 3.5.0
*/
function edit_form_image_editor()
{
$post = get_post();
$open = isset($_GET['image-editor']);
if ($open) {
require_once ABSPATH . 'wp-admin/includes/image-edit.php';
}
$thumb_url = false;
if ($attachment_id = intval($post->ID)) {
$thumb_url = wp_get_attachment_image_src($attachment_id, array(900, 450), true);
}
$filename = esc_html(basename($post->guid));
$title = esc_attr($post->post_title);
$alt_text = get_post_meta($post->ID, '_wp_attachment_image_alt', true);
$att_url = wp_get_attachment_url($post->ID);
if (wp_attachment_is_image($post->ID)) {
$image_edit_button = '';
if (wp_image_editor_supports(array('mime_type' => $post->post_mime_type))) {
$nonce = wp_create_nonce("image_editor-{$post->ID}");
$image_edit_button = "<input type='button' id='imgedit-open-btn-{$post->ID}' onclick='imageEdit.open( {$post->ID}, \"{$nonce}\" )' class='button' value='" . esc_attr__('Edit Image') . "' /> <span class='spinner'></span>";
}
?>
<div class="wp_attachment_holder">
<div class="imgedit-response" id="imgedit-response-<?php
echo $attachment_id;
?>
"></div>
<div<?php
if ($open) {
echo ' style="display:none"';
}
?>
class="wp_attachment_image" id="media-head-<?php
echo $attachment_id;
?>
">
<p id="thumbnail-head-<?php
echo $attachment_id;
?>
"><img class="thumbnail" src="<?php
echo set_url_scheme($thumb_url[0]);
?>
" style="max-width:100%" alt="" /></p>
<p><?php
echo $image_edit_button;
?>
</p>
</div>
<div<?php
if (!$open) {
echo ' style="display:none"';
}
?>
class="image-editor" id="image-editor-<?php
echo $attachment_id;
?>
">
<?php
if ($open) {
wp_image_editor($attachment_id);
}
?>
</div>
</div>
<?php
}
?>
<div class="wp_attachment_details">
<p>
<label for="attachment_caption"><strong><?php
_e('Caption');
?>
</strong></label><br />
<textarea class="widefat" name="excerpt" id="attachment_caption"><?php
echo $post->post_excerpt;
?>
</textarea>
</p>
<?php
if ('image' === substr($post->post_mime_type, 0, 5)) {
?>
<p>
<label for="attachment_alt"><strong><?php
_e('Alternative Text');
?>
</strong></label><br />
<input type="text" class="widefat" name="_wp_attachment_image_alt" id="attachment_alt" value="<?php
echo esc_attr($alt_text);
?>
" />
</p>
<?php
//.........这里部分代码省略.........
示例13: test_wp_generate_attachment_metadata_pdf
/**
* @ticket 31050
*/
public function test_wp_generate_attachment_metadata_pdf()
{
if (!wp_image_editor_supports(array('mime_type' => 'application/pdf'))) {
$this->markTestSkipped('Rendering PDFs is not supported on this system.');
}
$orig_file = DIR_TESTDATA . '/images/wordpress-gsoc-flyer.pdf';
$test_file = '/tmp/wordpress-gsoc-flyer.pdf';
copy($orig_file, $test_file);
$attachment_id = $this->factory->attachment->create_object($test_file, 0, array('post_mime_type' => 'application/pdf'));
$this->assertNotEmpty($attachment_id);
$expected = array('sizes' => array('thumbnail' => array('file' => "wordpress-gsoc-flyer-116x150.jpg", 'width' => 116, 'height' => 150, 'mime-type' => "image/jpeg"), 'medium' => array('file' => "wordpress-gsoc-flyer-232x300.jpg", 'width' => 232, 'height' => 300, 'mime-type' => "image/jpeg"), 'large' => array('file' => "wordpress-gsoc-flyer-791x1024.jpg", 'width' => 791, 'height' => 1024, 'mime-type' => "image/jpeg"), 'full' => array('file' => "wordpress-gsoc-flyer.jpg", 'width' => 1088, 'height' => 1408, 'mime-type' => "image/jpeg")));
$metadata = wp_generate_attachment_metadata($attachment_id, $test_file);
$this->assertSame($expected, $metadata);
unlink($test_file);
}
示例14: regenerate_interface
/**
* The main Regenerate Thumbnails interface, as displayed at Tools → Regen. Thumbnails.
*/
public function regenerate_interface()
{
if (!current_user_can($this->capability)) {
wp_die(__('Cheatin’ uh?'));
}
// This is a container for the results message that gets shown using JavaScript
echo '<div id="message" class="updated" style="display:none"></div>' . "\n";
// Just an overall wrapper, used to help style
echo '<div class="wrap regenthumbs">' . "\n";
echo '<h1>' . __('Regenerate Thumbnails', 'regenerate-thumbnails') . "</h1>\n";
// Make sure image editing is supported
if (!wp_image_editor_supports()) {
echo '<p>' . __("Sorry but your server doesn't support image editing which means that WordPress can't create thumbnails. Please ask your host to install the Imagick or GD PHP extensions.", 'regenerate-thumbnails') . '</p>';
} elseif (empty($_POST['regenerate-thumbnails']) && empty($_REQUEST['ids'])) {
$this->regenerate_interface_introduction();
} else {
$this->regenerate_interface_process();
}
echo '</div>';
// end "wrap regenthumbs"
return;
## Old page is below for reference while rewriting it above
global $wpdb;
?>
<div id="message" class="updated fade" style="display:none"></div>
<div class="wrap regenthumbs">
<h2><?php
_e('Regenerate Thumbnails', 'regenerate-thumbnails');
?>
</h2>
<?php
// If the button was clicked
if (!empty($_POST['regenerate-thumbnails']) || !empty($_REQUEST['ids'])) {
// Capability check
if (!current_user_can($this->capability)) {
wp_die(__('Cheatin’ uh?'));
}
// Create the list of image IDs
if (!empty($_REQUEST['ids'])) {
$images = array_map('intval', explode(',', trim($_REQUEST['ids'], ',')));
$ids = implode(',', $images);
// Form nonce check
check_admin_referer($this->create_nonce_name($images));
} else {
check_admin_referer('regenerate-thumbnails');
// Directly querying the database is normally frowned upon, but all
// of the API functions will return the full post objects which will
// suck up lots of memory. This is best, just not as future proof.
if (!($images = $wpdb->get_results("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'attachment' AND post_mime_type LIKE 'image/%' ORDER BY ID DESC"))) {
echo ' <p>' . sprintf(__("Unable to find any images. Are you sure <a href='%s'>some exist</a>?", 'regenerate-thumbnails'), esc_url(admin_url('upload.php?post_mime_type=image'))) . "</p></div>";
return;
}
// Generate the list of IDs
$ids = array();
foreach ($images as $image) {
$ids[] = $image->ID;
}
$ids = implode(',', $ids);
}
echo ' <p>' . __("Please be patient while the thumbnails are regenerated. This can take a while if your server is slow (inexpensive hosting) or if you have many images. Do not navigate away from this page until this script is done or the thumbnails will not be resized. You will be notified via this page when the regenerating is completed.", 'regenerate-thumbnails') . '</p>';
$count = count($images);
$text_goback = !empty($_GET['goback']) ? sprintf(__('To go back to the previous page, <a href="%s">click here</a>.', 'regenerate-thumbnails'), 'javascript:history.go(-1)') : '';
$text_failures = sprintf(__('All done! %1$s image(s) were successfully resized in %2$s seconds and there were %3$s failure(s). To try regenerating the failed images again, <a href="%4$s">click here</a>. %5$s', 'regenerate-thumbnails'), "' + rt_successes + '", "' + rt_totaltime + '", "' + rt_errors + '", esc_url(wp_nonce_url(admin_url('tools.php?page=regenerate-thumbnails&goback=1'), 'regenerate-thumbnails') . '&ids=') . "' + rt_failedlist + '", $text_goback);
$text_nofailures = sprintf(__('All done! %1$s image(s) were successfully resized in %2$s seconds and there were 0 failures. %3$s', 'regenerate-thumbnails'), "' + rt_successes + '", "' + rt_totaltime + '", $text_goback);
?>
<noscript><p><em><?php
_e('You must enable Javascript in order to proceed!', 'regenerate-thumbnails');
?>
</em></p></noscript>
<div id="regenthumbs-bar" style="position:relative;height:25px;">
<div id="regenthumbs-bar-percent" style="position:absolute;left:50%;top:50%;width:300px;margin-left:-150px;height:25px;margin-top:-9px;font-weight:bold;text-align:center;"></div>
</div>
<p><input type="button" class="button hide-if-no-js" name="regenthumbs-stop" id="regenthumbs-stop" value="<?php
_e('Abort Resizing Images', 'regenerate-thumbnails');
?>
" /></p>
<h3 class="title"><?php
_e('Debugging Information', 'regenerate-thumbnails');
?>
</h3>
<p>
<?php
printf(__('Total Images: %s', 'regenerate-thumbnails'), $count);
?>
<br />
<?php
printf(__('Images Resized: %s', 'regenerate-thumbnails'), '<span id="regenthumbs-debug-successcount">0</span>');
?>
//.........这里部分代码省略.........
示例15: is_usable
/**
* Checks if the image editor supports tiff images
*
* @since 1.0
*
* @return bool true is possible
*/
public function is_usable()
{
return wp_image_editor_supports(array('mime_type' => 'image/tiff'));
}