Version Description
- Fix: Uploading a PNG as a Retina was turning its transparency into black.
- Fix: Now LazyLoad used with Keep SRC only loads one image, the right one (instead of two before). Thanks to Shane Bishop, the creator of EWWW (https://wordpress.org/plugins/ewww-image-optimizer/).
Download this release
Release Info
Developer | TigrouMeow |
Plugin | WP Retina 2x |
Version | 5.5.1 |
Comparing to | |
See all releases |
Code changes from version 5.4.3 to 5.5.1
- ajax.php +3 -3
- core.php +8 -4
- readme.txt +7 -3
- wp-retina-2x.php +2 -44
- wr2x_admin.php +3 -3
ajax.php
CHANGED
@@ -381,14 +381,15 @@ class Meow_WR2X_Ajax {
|
|
381 |
|
382 |
try {
|
383 |
$tmpf = $this->check_get_ajax_uploaded_file();
|
384 |
-
$
|
|
|
385 |
$size = $image->get_size();
|
386 |
|
387 |
// Halve the size of the uploaded image
|
388 |
if ( $size['width'] >= $size['height'] ) $image->resize( round($size['width'] * .5), null );
|
389 |
else $image->resize( null, round($size['height'] * .5) );
|
390 |
$image->set_quality( get_option('wr2x_quality', 90) );
|
391 |
-
$halved = $image->save( $tmpf . 'H' );
|
392 |
if ( !$halved ) throw new Exception( "Failed to halve the uploaded image" );
|
393 |
if ( is_wp_error($halved) ) throw new Exception( $halved->get_error_message() );
|
394 |
|
@@ -400,7 +401,6 @@ class Meow_WR2X_Ajax {
|
|
400 |
|
401 |
// Register the file as a new attachment
|
402 |
$attachTo = 0; // TODO Support specifying which post the media attach to
|
403 |
-
$ftype = wp_check_filetype( $uploaded['file'] );
|
404 |
$attachment = array (
|
405 |
'post_mime_type' => $ftype['type'],
|
406 |
'post_parent' => $attachTo,
|
381 |
|
382 |
try {
|
383 |
$tmpf = $this->check_get_ajax_uploaded_file();
|
384 |
+
$ftype = wp_check_filetype( $_POST['filename'] );
|
385 |
+
$image = wp_get_image_editor( $tmpf, array ( 'mime_type' => $ftype['type'] ) );
|
386 |
$size = $image->get_size();
|
387 |
|
388 |
// Halve the size of the uploaded image
|
389 |
if ( $size['width'] >= $size['height'] ) $image->resize( round($size['width'] * .5), null );
|
390 |
else $image->resize( null, round($size['height'] * .5) );
|
391 |
$image->set_quality( get_option('wr2x_quality', 90) );
|
392 |
+
$halved = $image->save( $tmpf . 'H', $ftype['type'] );
|
393 |
if ( !$halved ) throw new Exception( "Failed to halve the uploaded image" );
|
394 |
if ( is_wp_error($halved) ) throw new Exception( $halved->get_error_message() );
|
395 |
|
401 |
|
402 |
// Register the file as a new attachment
|
403 |
$attachTo = 0; // TODO Support specifying which post the media attach to
|
|
|
404 |
$attachment = array (
|
405 |
'post_mime_type' => $ftype['type'],
|
406 |
'post_parent' => $attachTo,
|
core.php
CHANGED
@@ -102,7 +102,7 @@ class Meow_WR2X_Core {
|
|
102 |
include( __DIR__ . '/inc/simple_html_dom.php' );
|
103 |
|
104 |
$lazysize = get_option( "wr2x_picturefill_lazysizes" ) && $this->admin->is_registered();
|
105 |
-
$
|
106 |
$nodes_count = 0;
|
107 |
$nodes_replaced = 0;
|
108 |
$html = str_get_html( $buffer );
|
@@ -135,9 +135,13 @@ class Meow_WR2X_Core {
|
|
135 |
$this->log( "The src-set has already been created but it will be modifid to data-srcset for lazyload." );
|
136 |
$element->class = $element->class . ' lazyload';
|
137 |
$element->{'data-srcset'} = $element->srcset;
|
138 |
-
$
|
139 |
-
if ( $killsrc )
|
140 |
$element->src = null;
|
|
|
|
|
|
|
|
|
|
|
141 |
$to = $element;
|
142 |
$buffer = str_replace( trim( $from, "</> "), trim( $to, "</> " ), $buffer );
|
143 |
$this->log( "The img tag '$from' was rewritten to '$to'" );
|
@@ -166,7 +170,7 @@ class Meow_WR2X_Core {
|
|
166 |
}
|
167 |
else
|
168 |
$element->srcset = "$img_url, $retina_url 2x";
|
169 |
-
if ( $
|
170 |
$element->src = null;
|
171 |
else {
|
172 |
$img_src = apply_filters( 'wr2x_img_src', $element->src );
|
102 |
include( __DIR__ . '/inc/simple_html_dom.php' );
|
103 |
|
104 |
$lazysize = get_option( "wr2x_picturefill_lazysizes" ) && $this->admin->is_registered();
|
105 |
+
$killSrc = !get_option( "wr2x_picturefill_keep_src" );
|
106 |
$nodes_count = 0;
|
107 |
$nodes_replaced = 0;
|
108 |
$html = str_get_html( $buffer );
|
135 |
$this->log( "The src-set has already been created but it will be modifid to data-srcset for lazyload." );
|
136 |
$element->class = $element->class . ' lazyload';
|
137 |
$element->{'data-srcset'} = $element->srcset;
|
138 |
+
if ( $killSrc ) {
|
|
|
139 |
$element->src = null;
|
140 |
+
}
|
141 |
+
else {
|
142 |
+
// If SRC is kept, to avoid it to load before LazySizes kicks in, we set srcset to a blank 1x1 pixel.
|
143 |
+
$element->srcset = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
144 |
+
}
|
145 |
$to = $element;
|
146 |
$buffer = str_replace( trim( $from, "</> "), trim( $to, "</> " ), $buffer );
|
147 |
$this->log( "The img tag '$from' was rewritten to '$to'" );
|
170 |
}
|
171 |
else
|
172 |
$element->srcset = "$img_url, $retina_url 2x";
|
173 |
+
if ( $killSrc )
|
174 |
$element->src = null;
|
175 |
else {
|
176 |
$img_src = apply_filters( 'wr2x_img_src', $element->src );
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== WP Retina 2x ===
|
2 |
Contributors: TigrouMeow
|
3 |
Tags: retina, images, image, responsive, lazysizes, lazy, attachment, media, files, iphone, ipad, high-dpi
|
4 |
-
Requires at least:
|
5 |
-
Tested up to:
|
6 |
-
Stable tag: 5.
|
7 |
|
8 |
Make your website look beautiful and crisp on modern displays by creating and displaying retina images. WP 4.4+ is also supported and enhanced.
|
9 |
|
@@ -33,6 +33,10 @@ More information and tutorial available one https://meowapps.com/wp-retina-2x/.
|
|
33 |
|
34 |
== Changelog ==
|
35 |
|
|
|
|
|
|
|
|
|
36 |
= 5.4.3 =
|
37 |
* Add: New hooks: wr2x_before_regenerate, wr2x_before_generate_thumbnails, wr2x_generate_thumbnails, wr2x_regenerate and wr2x_upload_retina.
|
38 |
* Fix: Issues where happening with a few themes (actually the pagebuilder they use) after the last update.
|
1 |
=== WP Retina 2x ===
|
2 |
Contributors: TigrouMeow
|
3 |
Tags: retina, images, image, responsive, lazysizes, lazy, attachment, media, files, iphone, ipad, high-dpi
|
4 |
+
Requires at least: 4.4
|
5 |
+
Tested up to: 5.0
|
6 |
+
Stable tag: 5.5.1
|
7 |
|
8 |
Make your website look beautiful and crisp on modern displays by creating and displaying retina images. WP 4.4+ is also supported and enhanced.
|
9 |
|
33 |
|
34 |
== Changelog ==
|
35 |
|
36 |
+
= 5.5.1 =
|
37 |
+
* Fix: Uploading a PNG as a Retina was turning its transparency into black.
|
38 |
+
* Fix: Now LazyLoad used with Keep SRC only loads one image, the right one (instead of two before). Thanks to Shane Bishop, the creator of EWWW (https://wordpress.org/plugins/ewww-image-optimizer/).
|
39 |
+
|
40 |
= 5.4.3 =
|
41 |
* Add: New hooks: wr2x_before_regenerate, wr2x_before_generate_thumbnails, wr2x_generate_thumbnails, wr2x_regenerate and wr2x_upload_retina.
|
42 |
* Fix: Issues where happening with a few themes (actually the pagebuilder they use) after the last update.
|
wp-retina-2x.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP Retina 2x
|
4 |
Plugin URI: https://meowapps.com
|
5 |
Description: Make your website look beautiful and crisp on modern displays by creating + displaying retina images.
|
6 |
-
Version: 5.
|
7 |
Author: Jordy Meow
|
8 |
Author URI: https://meowapps.com
|
9 |
Text Domain: wp-retina-2x
|
@@ -29,7 +29,7 @@ if ( class_exists( 'Meow_WR2X_Core' ) ) {
|
|
29 |
global $wr2x_picturefill, $wr2x_retinajs, $wr2x_lazysizes,
|
30 |
$wr2x_retina_image, $wr2x_core;
|
31 |
|
32 |
-
$wr2x_version = '5.
|
33 |
$wr2x_retinajs = '2.0.0';
|
34 |
$wr2x_picturefill = '3.0.2';
|
35 |
$wr2x_lazysizes = '4.0.4';
|
@@ -44,46 +44,4 @@ require( 'core.php' );
|
|
44 |
$wr2x_core = new Meow_WR2X_Core( $wr2x_admin );
|
45 |
$wr2x_admin->core = $wr2x_core;
|
46 |
|
47 |
-
/*******************************************************************************
|
48 |
-
* TODO: OLD PRO, THIS FUNCTION SHOULD BE REMOVED IN THE FUTURE
|
49 |
-
******************************************************************************/
|
50 |
-
|
51 |
-
add_action( 'admin_notices', 'wr2x_meow_old_version_admin_notices' );
|
52 |
-
|
53 |
-
function wr2x_meow_old_version_admin_notices() {
|
54 |
-
if ( !current_user_can( 'install_plugins' ) )
|
55 |
-
return;
|
56 |
-
if ( isset( $_POST['wr2x_reset_sub'] ) ) {
|
57 |
-
if ( check_admin_referer( 'wr2x_remove_expired_data' ) ) {
|
58 |
-
delete_transient( 'wr2x_validated' );
|
59 |
-
delete_option( 'wr2x_pro_serial' );
|
60 |
-
delete_option( 'wr2x_pro_status' );
|
61 |
-
}
|
62 |
-
}
|
63 |
-
$subscr_id = get_option( 'wr2x_pro_serial', "" );
|
64 |
-
if ( empty( $subscr_id ) )
|
65 |
-
return;
|
66 |
-
|
67 |
-
$forever = strpos( $subscr_id, 'F-' ) !== false;
|
68 |
-
$yearly = strpos( $subscr_id, 'I-' ) !== false;
|
69 |
-
if ( !$forever && !$yearly )
|
70 |
-
return;
|
71 |
-
?>
|
72 |
-
<div class="error">
|
73 |
-
<p>
|
74 |
-
<h2>IMPORTANT MESSAGE ABOUT WP RETINA 2X</h2>
|
75 |
-
In order to comply with WordPress.org, BIG CHANGES in the code and how the plugin was sold were to be made. The plugin needs requires to be purchased and updated through the new <a target='_blank' href="https://store.meowapps.com">Meow Apps Store</a>. This store is also more robust (keys, websites management, invoices, etc). Now, since WordPress.org only accepts free plugins on its repository, this is the one currently installed. Therefore, you need to take an action. <b>Please click here to know more about your license and to learn what to do: <a target='_blank' href='https://meowapps.com/?mkey=<?php echo $subscr_id ?>'>License <?php echo $subscr_id ?></a></b>.
|
76 |
-
</p>
|
77 |
-
<p>
|
78 |
-
<form method="post" action="">
|
79 |
-
<input type="hidden" name="wr2x_reset_sub" value="true">
|
80 |
-
<?php wp_nonce_field( 'wr2x_remove_expired_data' ); ?>
|
81 |
-
<input type="submit" name="submit" id="submit" class="button" value="Got it. Clear this!">
|
82 |
-
<br /><small><b>Make sure you followed the instruction before clicking this button.</b></small>
|
83 |
-
</form>
|
84 |
-
</p>
|
85 |
-
</div>
|
86 |
-
<?php
|
87 |
-
}
|
88 |
-
|
89 |
?>
|
3 |
Plugin Name: WP Retina 2x
|
4 |
Plugin URI: https://meowapps.com
|
5 |
Description: Make your website look beautiful and crisp on modern displays by creating + displaying retina images.
|
6 |
+
Version: 5.5.1
|
7 |
Author: Jordy Meow
|
8 |
Author URI: https://meowapps.com
|
9 |
Text Domain: wp-retina-2x
|
29 |
global $wr2x_picturefill, $wr2x_retinajs, $wr2x_lazysizes,
|
30 |
$wr2x_retina_image, $wr2x_core;
|
31 |
|
32 |
+
$wr2x_version = '5.5.1';
|
33 |
$wr2x_retinajs = '2.0.0';
|
34 |
$wr2x_picturefill = '3.0.2';
|
35 |
$wr2x_lazysizes = '4.0.4';
|
44 |
$wr2x_core = new Meow_WR2X_Core( $wr2x_admin );
|
45 |
$wr2x_admin->core = $wr2x_core;
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
?>
|
wr2x_admin.php
CHANGED
@@ -361,7 +361,7 @@ class Meow_WR2X_Admin extends MeowApps_Admin {
|
|
361 |
<option ' . selected( 'HTML Rewrite', $value, false ) . 'value="HTML Rewrite">HTML Rewrite</option>
|
362 |
<option ' . selected( 'Retina-Images', $value, false ) . 'value="Retina-Images">Retina-Images</option>
|
363 |
<option ' . selected( 'none', $value, false ) . 'value="none">None</option>
|
364 |
-
</select><small><br />' . __( 'In all cases (including "None"), Retina support will be added to the Responsive Images. Check the <a target="_blank" href="
|
365 |
echo $html;
|
366 |
}
|
367 |
|
@@ -407,7 +407,7 @@ class Meow_WR2X_Admin extends MeowApps_Admin {
|
|
407 |
$value = get_option( 'wr2x_picturefill_keep_src', null );
|
408 |
$html = '<input type="checkbox" id="wr2x_picturefill_keep_src" name="wr2x_picturefill_keep_src" value="1" ' .
|
409 |
checked( 1, get_option( 'wr2x_picturefill_keep_src' ), false ) . '/>';
|
410 |
-
$html .= __( '<label>Enable</label><br /><small>With PictureFill, <b>src</b> tags are replaced by <b>src-set</b> tags
|
411 |
echo $html;
|
412 |
}
|
413 |
|
@@ -416,7 +416,7 @@ class Meow_WR2X_Admin extends MeowApps_Admin {
|
|
416 |
$html = '<input ' . disabled( $this->is_registered(), false, false ) . ' type="checkbox" id="wr2x_picturefill_lazysizes"
|
417 |
name="wr2x_picturefill_lazysizes" value="1" ' .
|
418 |
checked( 1, get_option( 'wr2x_picturefill_lazysizes' ), false ) . '/>';
|
419 |
-
$html .= __( '<label>Enabled</label><br /><small>Retina images will not be loaded until the visitor gets close to them. HTML will be rewritten and the lazysizes script will be also loaded. </small>', 'wp-retina-2x' );
|
420 |
echo $html;
|
421 |
}
|
422 |
|
361 |
<option ' . selected( 'HTML Rewrite', $value, false ) . 'value="HTML Rewrite">HTML Rewrite</option>
|
362 |
<option ' . selected( 'Retina-Images', $value, false ) . 'value="Retina-Images">Retina-Images</option>
|
363 |
<option ' . selected( 'none', $value, false ) . 'value="none">None</option>
|
364 |
+
</select><small><br />' . __( 'In all cases (including "None"), Retina support will be added to the Responsive Images. Check the <a target="_blank" href="https://meowapps.com/wp-retina-2x-methods" />Retina Methods</a> page if you want to know more about those methods.', 'wp-retina-2x' ) . '</small>';
|
365 |
echo $html;
|
366 |
}
|
367 |
|
407 |
$value = get_option( 'wr2x_picturefill_keep_src', null );
|
408 |
$html = '<input type="checkbox" id="wr2x_picturefill_keep_src" name="wr2x_picturefill_keep_src" value="1" ' .
|
409 |
checked( 1, get_option( 'wr2x_picturefill_keep_src' ), false ) . '/>';
|
410 |
+
$html .= __( '<label>Enable</label><br /><small>With PictureFill, <b>src</b> tags are replaced by <b>src-set</b> tags, but Google might fail to reference those images. This option will keep the SRC for SEO purpose, but that will force the download of two images (standard, then retina) by the browsers. Please use the <b>Lazy Retina</b> option below as it avoid this to happen (as well as making it loading lazily).</small>', 'wp-retina-2x' );
|
411 |
echo $html;
|
412 |
}
|
413 |
|
416 |
$html = '<input ' . disabled( $this->is_registered(), false, false ) . ' type="checkbox" id="wr2x_picturefill_lazysizes"
|
417 |
name="wr2x_picturefill_lazysizes" value="1" ' .
|
418 |
checked( 1, get_option( 'wr2x_picturefill_lazysizes' ), false ) . '/>';
|
419 |
+
$html .= __( '<label>Enabled</label><br /><small>Retina images will not be loaded until the visitor gets close to them. HTML will be rewritten and the lazysizes script will be also loaded. The result will be a <b>faster website</b> for everyone, that consumes less bandwidth.</small>', 'wp-retina-2x' );
|
420 |
echo $html;
|
421 |
}
|
422 |
|