• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wr2x_retina_info函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wr2x_retina_info函数的典型用法代码示例。如果您正苦于以下问题:PHP wr2x_retina_info函数的具体用法?PHP wr2x_retina_info怎么用?PHP wr2x_retina_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wr2x_retina_info函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: wr2x_manage_media_custom_column

function wr2x_manage_media_custom_column($column_name, $id)
{
    if ($column_name != 'Retina') {
        return;
    }
    if (wr2x_is_ignore($id)) {
        echo "<img style='margin-top: -2px; margin-bottom: 2px; width: 16px; height: 16px;' src='" . plugin_dir_url(__FILE__) . "img/tick-circle.png' />";
        return;
    }
    // Check if the attachment is an image
    $meta = wp_get_attachment_metadata($id);
    if (!wr2x_is_image_meta($meta)) {
        return "";
    }
    $isAlright = true;
    $info = wr2x_retina_info($id);
    foreach ($info as $name => $attr) {
        if ($attr == 'PENDING' || is_array($attr)) {
            $isAlright = false;
        }
    }
    // Displays the result
    echo "<p id='wr2x_attachment_{$id}' style='margin-bottom: 2px;'>";
    if ($isAlright) {
        echo "<img style='margin-top: -2px; margin-bottom: 2px; width: 16px; height: 16px;' src='" . plugin_dir_url(__FILE__) . "img/tick-circle.png' />";
    } else {
        echo "<a href='upload.php?page=wp-retina-2x'><img style='margin-top: -2px; margin-bottom: 2px; width: 16px; height: 16px;' src='" . plugin_dir_url(__FILE__) . "img/exclamation.png' /></a>";
    }
    echo "</p>";
}
开发者ID:cimocimocimo,项目名称:staydrysystems.com,代码行数:30,代码来源:wr2x_media-library.php


示例2: wr2x_manage_media_custom_column

function wr2x_manage_media_custom_column($column_name, $id)
{
    if ($column_name != 'Retina') {
        return;
    }
    if (wr2x_is_ignore($id)) {
        echo "<img style='margin-top: -2px; margin-bottom: 2px; width: 16px; height: 16px;' src='" . trailingslashit(WP_PLUGIN_URL) . trailingslashit('wp-retina-2x/img') . "tick-circle.png' />";
        return;
    }
    // Check if the attachment is an image
    $meta = wp_get_attachment_metadata($id);
    if (!($meta && isset($meta['width']) && isset($meta['height']))) {
        return;
    }
    $isAlright = true;
    $info = wr2x_retina_info($id);
    foreach ($info as $name => $attr) {
        if ($attr == 'PENDING' || is_array($attr)) {
            $isAlright = false;
        }
    }
    // Displays the result
    echo "<p id='wr2x_attachment_{$id}' style='margin-bottom: 2px;'>";
    if ($isAlright) {
        echo "<img style='margin-top: -2px; margin-bottom: 2px; width: 16px; height: 16px;' src='" . trailingslashit(WP_PLUGIN_URL) . trailingslashit('wp-retina-2x/img') . "tick-circle.png' />";
    } else {
        echo "<a href='upload.php?page=wp-retina-2x'><img style='margin-top: -2px; margin-bottom: 2px; width: 16px; height: 16px;' src='" . trailingslashit(WP_PLUGIN_URL) . trailingslashit('wp-retina-2x/img') . "exclamation.png' /></a>";
    }
    echo "</p>";
}
开发者ID:roycocup,项目名称:enclothed,代码行数:30,代码来源:wr2x_media-library.php


示例3: wr2x_manage_media_custom_column

function wr2x_manage_media_custom_column($column_name, $id)
{
    if ($column_name == 'Retina') {
        echo '<div id="wr2x-info-' . $id . '">';
        $info = wr2x_retina_info($id);
        echo wpr2x_html_get_basic_retina_info($id, $info);
        echo '</div>';
        echo "<a style='position: relative; top: -1px; margin-left: 4px;' onclick='wr2x_generate(" . $id . ", true)' id='wr2x_generate_button_" . $id . "' class='wr2x-button'>" . __("GENERATE", 'wp-retina-2x') . "</a>";
    } else {
        if ($column_name == 'Retina-Actions') {
        }
    }
}
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:13,代码来源:wr2x_media-library.php


示例4: wr2x_manage_media_custom_column

function wr2x_manage_media_custom_column($column_name, $id)
{
    if ($column_name == 'Retina') {
        echo '<div id="wr2x-info-' . $id . '">';
        $info = wr2x_retina_info($id);
        echo wpr2x_html_get_basic_retina_info($id, $info);
        echo '</div>';
        //echo '<div style="clear: both;">';
        //echo "<div style='float: left;' class='actions'>";
        echo "<a style='position: relative; top: -1px; margin-left: 4px;' onclick='wr2x_generate(" . $id . ", true)' id='wr2x_generate_button_" . $id . "' class='wr2x-button'>" . __("GENERATE", 'wp-retina-2x') . "</a>";
        //echo "</div>";
    } else {
        if ($column_name == 'Retina-Actions') {
        }
    }
    // if ( wr2x_is_ignore( $id ) ) {
    // 	echo "<img style='margin-top: -2px; margin-bottom: 2px; width: 16px; height: 16px;' src='" . plugin_dir_url( __FILE__ ) . "img/tick-circle.png' />";
    // 	return;
    // }
    //
    // // Check if the attachment is an image
    // $meta = wp_get_attachment_metadata($id);
    // if ( !wr2x_is_image_meta( $meta ) ) {
    // 	return "";
    // }
    //
    // $isAlright = true;
    // $info = wr2x_retina_info( $id );
    // foreach ( $info as $name => $attr ) {
    // 	if ( $attr == 'PENDING' || is_array( $attr ) )
    // 		$isAlright = false;
    // }
    //
    // // Displays the result
    // echo "<p id='wr2x_attachment_$id' style='margin-bottom: 2px;'>";
    // if ( $isAlright ) {
    // 	echo "<img style='margin-top: -2px; margin-bottom: 2px; width: 16px; height: 16px;' src='" . plugin_dir_url( __FILE__ ) . "img/tick-circle.png' />";
    // }
    // else {
    // 	echo "<a href='upload.php?page=wp-retina-2x'><img style='margin-top: -2px; margin-bottom: 2px; width: 16px; height: 16px;' src='" . plugin_dir_url( __FILE__ ) . "img/exclamation.png' /></a>";
    // }
    // echo "</p>";
}
开发者ID:shuramita,项目名称:dhsd,代码行数:43,代码来源:wr2x_media-library.php


示例5: wr2x_calculate_issues

function wr2x_calculate_issues()
{
    global $wpdb;
    $postids = $wpdb->get_col("\n\t\tSELECT p.ID FROM {$wpdb->posts} p\n\t\tWHERE post_status = 'inherit'\n\t\tAND post_type = 'attachment'" . wr2x_create_sql_if_wpml_original() . "\n\t\tAND ( post_mime_type = 'image/jpeg' OR\n\t\t\tpost_mime_type = 'image/jpg' OR\n\t\t\tpost_mime_type = 'image/png' OR\n\t\t\tpost_mime_type = 'image/gif' )\n\t");
    $issues = array();
    foreach ($postids as $id) {
        $info = wr2x_retina_info($id);
        if (wr2x_info_has_issues($info)) {
            array_push($issues, $id);
        }
    }
    set_transient('wr2x_ignores', array());
    set_transient('wr2x_issues', $issues);
}
开发者ID:radscheit,项目名称:unicorn,代码行数:14,代码来源:wp-retina-2x.php


示例6: wpr2x_wp_retina_2x

function wpr2x_wp_retina_2x()
{
    $view = isset($_GET['view']) ? $_GET['view'] : 'issues';
    $paged = isset($_GET['paged']) ? $_GET['paged'] : 1;
    $s = isset($_GET['s']) ? $_GET['s'] : null;
    $issues = $count = 0;
    $sizes = wr2x_get_image_sizes();
    $posts_per_page = 15;
    // TODO: HOW TO GET THE NUMBER OF MEDIA PER PAGES? IT IS NOT get_option('posts_per_page');
    $issues = wr2x_get_issues();
    $ignored = wr2x_get_ignores();
    ?>
	<div class='wrap'>
	<?php 
    jordy_meow_donation(true);
    ?>
	<div id="icon-upload" class="icon32"><br></div>
	<h2>WP Retina 2x <?php 
    by_jordy_meow();
    ?>
</h2>

	<?php 
    if ($view == 'issues') {
        global $wpdb;
        $totalcount = $wpdb->get_var($wpdb->prepare("\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM {$wpdb->posts} p\n\t\t\tWHERE post_status = 'inherit'\n\t\t\tAND post_type = 'attachment'\n\t\t\tAND post_title LIKE %s\n\t\t\tAND ( post_mime_type = 'image/jpeg' OR\n\t\t\tpost_mime_type = 'image/png' OR\n\t\t\tpost_mime_type = 'image/gif' )\n\t\t", '%' . $s . '%'));
        $postin = count($issues) < 1 ? array(-1) : $issues;
        $query = new WP_Query(array('post_status' => 'inherit', 'post_type' => 'attachment', 'post__in' => $postin, 'paged' => $paged, 'posts_per_page' => $posts_per_page, 's' => $s));
    } else {
        if ($view == 'ignored') {
            global $wpdb;
            $totalcount = $wpdb->get_var($wpdb->prepare("\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM {$wpdb->posts} p\n\t\t\tWHERE post_status = 'inherit'\n\t\t\tAND post_type = 'attachment'\n\t\t\tAND post_title LIKE %s\n\t\t\tAND ( post_mime_type = 'image/jpeg' OR\n\t\t\tpost_mime_type = 'image/jpg' OR\n\t\t\tpost_mime_type = 'image/png' OR\n\t\t\tpost_mime_type = 'image/gif' )\n\t\t", '%' . $s . '%'));
            $postin = count($ignored) < 1 ? array(-1) : $ignored;
            $query = new WP_Query(array('post_status' => 'inherit', 'post_type' => 'attachment', 'post__in' => $postin, 'paged' => $paged, 'posts_per_page' => $posts_per_page, 's' => $s));
        } else {
            $query = new WP_Query(array('post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image/jpeg,image/gif,image/jpg,image/png', 'paged' => $paged, 'posts_per_page' => $posts_per_page, 's' => $s));
            //$s
            $totalcount = $query->found_posts;
        }
    }
    $issues_count = count($issues);
    // If 'search', then we need to clean-up the issues count
    if ($s && $issues_count > 0) {
        global $wpdb;
        $issues_count = $wpdb->get_var($wpdb->prepare("\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM {$wpdb->posts} p\n\t\t\tWHERE id IN ( " . implode(',', $issues) . " )\n\t\t\tAND post_title LIKE %s\n\t\t", '%' . $s . '%'));
    }
    $results = array();
    $count = $query->found_posts;
    $pagescount = $query->max_num_pages;
    foreach ($query->posts as $post) {
        $info = wr2x_retina_info($post->ID);
        array_push($results, array('post' => $post, 'info' => $info));
    }
    ?>

	<div style='background: #FFF; padding: 5px; border-radius: 4px; height: 28px; box-shadow: 0px 0px 6px #C2C2C2;'>
		
		<!-- GENERATE ALL -->
		<a id='wr2x_generate_button_all' onclick='wr2x_generate_all()' class='button-primary' style='float: left;'><img style='position: relative; top: 3px; left: -2px; margin-right: 3px; width: 16px; height: 16px;' src='<?php 
    echo trailingslashit(WP_PLUGIN_URL) . trailingslashit('wp-retina-2x/img');
    ?>
photo-album--plus.png' /><?php 
    _e("Generate", 'wp-retina-2x');
    ?>
</a>
		
		<!-- SEARCH -->
		<form id="posts-filter" action="upload.php" method="get">
			<p class="search-box" style='margin-left: 5px; float: left;'>
				<input type="search" name="s" value="<?php 
    echo $s ? $s : "";
    ?>
">
				<input type="hidden" name="page" value="wp-retina-2x">
				<input type="hidden" name="view" value="<?php 
    echo $view;
    ?>
">
				<input type="hidden" name="paged" value="<?php 
    echo $paged;
    ?>
">
				<input type="submit" class="button" value="Search">
			</p>
		</form>

		<!-- REMOVE BUTTON ALL -->
		<a id='wr2x_remove_button_all' onclick='wr2x_delete_all()' class='button button-red' style='float: right;'><img style='position: relative; top: 3px; left: -2px; margin-right: 3px; width: 16px; height: 16px;' src='<?php 
    echo trailingslashit(WP_PLUGIN_URL) . trailingslashit('wp-retina-2x/img');
    ?>
burn.png' /><?php 
    _e("Delete all @2x", 'wp-retina-2x');
    ?>
</a>

		<!-- REFRESH -->
		<a id='wr2x_refresh' href='?page=wp-retina-2x&view=issues&refresh=true' class='button-primary' style='float: right; margin-right: 5px;'><img style='position: relative; top: 3px; left: -2px; margin-right: 3px; width: 16px; height: 16px;' src='<?php 
    echo trailingslashit(WP_PLUGIN_URL) . trailingslashit('wp-retina-2x/img');
    ?>
refresh.png' /><?php 
//.........这里部分代码省略.........
开发者ID:srinivasulurao,项目名称:transcharity,代码行数:101,代码来源:wr2x_retina-dashboard.php


示例7: wpr2x_wp_retina_2x

function wpr2x_wp_retina_2x()
{
    $view = isset($_GET['view']) ? $_GET['view'] : 'issues';
    $paged = isset($_GET['paged']) ? $_GET['paged'] : 1;
    $s = isset($_GET['s']) && !empty($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
    $issues = $count = 0;
    $posts_per_page = 15;
    // TODO: HOW TO GET THE NUMBER OF MEDIA PER PAGES? IT IS NOT get_option('posts_per_page');
    $issues = wr2x_get_issues();
    $ignored = wr2x_get_ignores();
    echo '<div class="wrap">';
    jordy_meow_donation(true);
    echo "<h1>Retina";
    by_jordy_meow();
    echo "</h1>";
    if (wr2x_is_pro() && $view == 'issues') {
        global $wpdb;
        $totalcount = $wpdb->get_var($wpdb->prepare("\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM {$wpdb->posts} p\n\t\t\tWHERE post_status = 'inherit'\n\t\t\tAND post_type = 'attachment'" . wr2x_create_sql_if_wpml_original() . "\n\t\t\tAND post_title LIKE %s\n\t\t\tAND ( post_mime_type = 'image/jpeg' OR\n\t\t\tpost_mime_type = 'image/png' OR\n\t\t\tpost_mime_type = 'image/gif' )\n\t\t", '%' . $s . '%'));
        $postin = count($issues) < 1 ? array(-1) : $issues;
        $query = new WP_Query(array('post_status' => 'inherit', 'post_type' => 'attachment', 'post__in' => $postin, 'paged' => $paged, 'posts_per_page' => $posts_per_page, 's' => $s));
    } else {
        if (wr2x_is_pro() && $view == 'ignored') {
            global $wpdb;
            $totalcount = $wpdb->get_var($wpdb->prepare("\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM {$wpdb->posts} p\n\t\t\tWHERE post_status = 'inherit'\n\t\t\tAND post_type = 'attachment'" . wr2x_create_sql_if_wpml_original() . "\n\t\t\tAND post_title LIKE %s\n\t\t\tAND ( post_mime_type = 'image/jpeg' OR\n\t\t\tpost_mime_type = 'image/jpg' OR\n\t\t\tpost_mime_type = 'image/png' OR\n\t\t\tpost_mime_type = 'image/gif' )\n\t\t", '%' . $s . '%'));
            $postin = count($ignored) < 1 ? array(-1) : $ignored;
            $query = new WP_Query(array('post_status' => 'inherit', 'post_type' => 'attachment', 'post__in' => $postin, 'paged' => $paged, 'posts_per_page' => $posts_per_page, 's' => $s));
        } else {
            $query = new WP_Query(array('post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image/jpeg,image/gif,image/jpg,image/png', 'paged' => $paged, 'posts_per_page' => $posts_per_page, 's' => $s));
            //$s
            $totalcount = $query->found_posts;
        }
    }
    $issues_count = count($issues);
    // If 'search', then we need to clean-up the issues count
    if ($s && $issues_count > 0) {
        global $wpdb;
        $issues_count = $wpdb->get_var($wpdb->prepare("\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM {$wpdb->posts} p\n\t\t\tWHERE id IN ( " . implode(',', $issues) . " )" . wr2x_create_sql_if_wpml_original() . "\n\t\t\tAND post_title LIKE %s\n\t\t", '%' . $s . '%'));
    }
    $results = array();
    $count = $query->found_posts;
    $pagescount = $query->max_num_pages;
    foreach ($query->posts as $post) {
        $info = wr2x_retina_info($post->ID);
        array_push($results, array('post' => $post, 'info' => $info));
    }
    ?>

	<div style='background: #FFF; padding: 5px; border-radius: 4px; height: 28px; box-shadow: 0px 0px 6px #C2C2C2;'>

		<!-- REFRESH -->
		<a id='wr2x_refresh' href='?page=wp-retina-2x&view=issues&refresh=true' class='button' style='float: left;'><img style='position: relative; top: 3px; left: -2px; margin-right: 3px; width: 16px; height: 16px;' src='<?php 
    echo plugin_dir_url(__FILE__);
    ?>
img/refresh.png' /><?php 
    _e("Refresh", 'wp-retina-2x');
    ?>
</a>

		<!-- SEARCH -->
		<form id="posts-filter" action="upload.php" method="get">
			<p class="search-box" style='margin-left: 5px; float: left;'>
				<input type="search" name="s" value="<?php 
    echo $s ? $s : "";
    ?>
">
				<input type="hidden" name="page" value="wp-retina-2x">
				<input type="hidden" name="view" value="<?php 
    echo $view;
    ?>
">
				<input type="hidden" name="paged" value="<?php 
    echo $paged;
    ?>
">
				<input type="submit" class="button" value="Search">
			</p>
		</form>

		<!-- REMOVE BUTTON ALL -->
		<a id='wr2x_remove_button_all' onclick='wr2x_delete_all()' class='button button-red' style='float: right;'><img style='position: relative; top: 3px; left: -2px; margin-right: 3px; width: 16px; height: 16px;' src='<?php 
    echo plugin_dir_url(__FILE__);
    ?>
img/burn.png' /><?php 
    _e("Bulk Delete", 'wp-retina-2x');
    ?>
</a>

		<!-- GENERATE ALL -->
		<a id='wr2x_generate_button_all' onclick='wr2x_generate_all()' class='button-primary' style='float: right; margin-right: 5px;'><img style='position: relative; top: 3px; left: -2px; margin-right: 3px; width: 16px; height: 16px;' src='<?php 
    echo plugin_dir_url(__FILE__);
    ?>
img/photo-album--plus.png' /><?php 
    _e("Bulk Generate", 'wp-retina-2x');
    ?>
</a>


		<!-- PROGRESS -->
		<span style='margin-left: 12px; font-size: 13px; top: 5px; position: relative; color: #24547C; font-weight: bold;' id='wr2x_progression'></span>

//.........这里部分代码省略.........
开发者ID:shuramita,项目名称:dhsd,代码行数:101,代码来源:wr2x_retina-dashboard.php


示例8: wr2x_wp_ajax_wr2x_replace

function wr2x_wp_ajax_wr2x_replace()
{
    $tmpfname = wr2x_check_get_ajax_uploaded_file();
    $attachmentId = (int) $_POST['attachmentId'];
    $meta = wp_get_attachment_metadata($attachmentId);
    $current_file = get_attached_file($attachmentId);
    wr2x_delete_attachment($attachmentId);
    $pathinfo = pathinfo($current_file);
    $basepath = $pathinfo['dirname'];
    // Let's clean everything first
    if (wp_attachment_is_image($attachmentId)) {
        $sizes = wr2x_get_image_sizes();
        foreach ($sizes as $name => $attr) {
            if (isset($meta['sizes'][$name]) && isset($meta['sizes'][$name]['file']) && file_exists(trailingslashit($basepath) . $meta['sizes'][$name]['file'])) {
                $normal_file = trailingslashit($basepath) . $meta['sizes'][$name]['file'];
                $pathinfo = pathinfo($normal_file);
                $retina_file = trailingslashit($pathinfo['dirname']) . $pathinfo['filename'] . wr2x_retina_extension() . $pathinfo['extension'];
                // Test if the file exists and if it is actually a file (and not a dir)
                // Some old WordPress Media Library are sometimes broken and link to directories
                if (file_exists($normal_file) && is_file($normal_file)) {
                    unlink($normal_file);
                }
                if (file_exists($retina_file) && is_file($retina_file)) {
                    unlink($retina_file);
                }
            }
        }
    }
    if (file_exists($current_file)) {
        unlink($current_file);
    }
    // Insert the new file and delete the temporary one
    rename($tmpfname, $current_file);
    chmod($current_file, 0644);
    // Generate the images
    wp_update_attachment_metadata($attachmentId, wp_generate_attachment_metadata($attachmentId, $current_file));
    $meta = wp_get_attachment_metadata($attachmentId);
    wr2x_generate_images($meta);
    // Get the results
    $info = wr2x_retina_info($attachmentId);
    $results[$attachmentId] = wpr2x_html_get_basic_retina_info($attachmentId, $info);
    echo json_encode(array('success' => true, 'results' => $results, 'message' => __("Replaced successfully.", 'wp-retina-2x')));
    die;
}
开发者ID:frankynomad,项目名称:bux-wpcontent,代码行数:44,代码来源:wr2x_ajax.php


示例9: wr2x_wp_ajax_wr2x_replace

function wr2x_wp_ajax_wr2x_replace()
{
    if (!current_user_can('upload_files')) {
        echo json_encode(array('success' => false, 'message' => __("You do not have permission to upload files.", 'wp-retina-2x')));
        die;
    }
    $data = $_POST['data'];
    // Create the file as a TMP
    $tmpfname = tempnam(sys_get_temp_dir(), "wpx_");
    if ($tmpfname == FALSE) {
        $tmpdir = sys_get_temp_dir();
        if (!is_writable($tmpdir)) {
            echo json_encode(array('success' => false, 'message' => __("You don't have the rights to use a temporary directory.", 'wp-retina-2x')));
        } else {
            echo json_encode(array('success' => false, 'message' => __("The temporary directory could not be created.", 'wp-retina-2x')));
        }
        die;
    }
    $handle = fopen($tmpfname, "w");
    fwrite($handle, base64_decode($data));
    fclose($handle);
    // Check if it is an image
    $file_info = getimagesize($tmpfname);
    if (empty($file_info)) {
        unlink($tmpfname);
        echo json_encode(array('success' => false, 'message' => __("The file is not an image or the upload went wrong.", 'wp-retina-2x')));
        die;
    }
    $filedata = wp_check_filetype_and_ext($tmpfname, $_POST['filename']);
    if ($filedata["ext"] == "") {
        unlink($current_file);
        echo json_encode(array('success' => false, 'message' => __("You cannot use this file (wrong extension? wrong type?).", 'wp-retina-2x')));
        die;
    }
    $attachmentId = (int) $_POST['attachmentId'];
    $meta = wp_get_attachment_metadata($attachmentId);
    $current_file = get_attached_file($attachmentId);
    wr2x_delete_attachment($attachmentId);
    $pathinfo = pathinfo($current_file);
    $basepath = $pathinfo['dirname'];
    // Let's clean everything first
    if (wp_attachment_is_image($attachmentId)) {
        $sizes = wr2x_get_image_sizes();
        foreach ($sizes as $name => $attr) {
            if (isset($meta['sizes'][$name]) && isset($meta['sizes'][$name]['file']) && file_exists(trailingslashit($basepath) . $meta['sizes'][$name]['file'])) {
                $normal_file = trailingslashit($basepath) . $meta['sizes'][$name]['file'];
                $pathinfo = pathinfo($normal_file);
                $retina_file = trailingslashit($pathinfo['dirname']) . $pathinfo['filename'] . wr2x_retina_extension() . $pathinfo['extension'];
                // Test if the file exists and if it is actually a file (and not a dir)
                // Some old WordPress Media Library are sometimes broken and link to directories
                if (file_exists($normal_file) && is_file($normal_file)) {
                    unlink($normal_file);
                }
                if (file_exists($retina_file) && is_file($retina_file)) {
                    unlink($retina_file);
                }
            }
        }
    }
    if (file_exists($current_file)) {
        unlink($current_file);
    }
    // Insert the new file and delete the temporary one
    rename($tmpfname, $current_file);
    chmod($current_file, 0644);
    // Generate the images
    wp_update_attachment_metadata($attachmentId, wp_generate_attachment_metadata($attachmentId, $current_file));
    $meta = wp_get_attachment_metadata($attachmentId);
    wr2x_generate_images($meta);
    // Get the results
    $info = wr2x_retina_info($attachmentId);
    $results[$attachmentId] = $info;
    echo json_encode(array('success' => true, 'results' => $results, 'message' => __("Replaced successfully.", 'wp-retina-2x')));
    die;
}
开发者ID:roycocup,项目名称:enclothed,代码行数:75,代码来源:wr2x_ajax.php



注:本文中的wr2x_retina_info函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wrap函数代码示例发布时间:2022-05-23
下一篇:
PHP wr2x_getoption函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap