WP Retina 2x - Version 5.5.3

Version Description

  • Fix: Usage of Composer.
  • Update: If available, will use the Full-Size Retina for generating Retina thumbnails.
  • Fix: New version of HtmlDomParser.
  • Update: New dashboard.
Download this release

Release Info

Developer TigrouMeow
Plugin Icon 128x128 WP Retina 2x
Version 5.5.3
Comparing to
See all releases

Code changes from version 5.5.2 to 5.5.3

Files changed (3) hide show
  1. core.php +24 -6
  2. readme.txt +4 -2
  3. wp-retina-2x.php +2 -2
core.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
 
3
- require_once 'vendor/autoload.php';
4
- use KubAT\PhpSimple\HtmlDomParser;
5
 
6
  class Meow_WR2X_Core {
7
 
@@ -101,7 +100,7 @@ class Meow_WR2X_Core {
101
  function picture_rewrite( $buffer ) {
102
  if ( !isset( $buffer ) || trim( $buffer ) === '' )
103
  return $buffer;
104
- $html = new HtmlDomParser();
105
  $lazysize = get_option( "wr2x_picturefill_lazysizes" ) && $this->admin->is_registered();
106
  $killSrc = !get_option( "wr2x_picturefill_keep_src" );
107
  $nodes_count = 0;
@@ -634,6 +633,7 @@ class Meow_WR2X_Core {
634
  function resize( $file_path, $width, $height, $crop, $newfile, $customCrop = false ) {
635
  $crop_params = $crop == '1' ? true : $crop;
636
  $orig_size = getimagesize( $file_path );
 
637
  $image_src[0] = $file_path;
638
  $image_src[1] = $orig_size[0];
639
  $image_src[2] = $orig_size[1];
@@ -986,16 +986,34 @@ class Meow_WR2X_Core {
986
  return $meta;
987
  }
988
 
 
 
 
 
 
 
 
989
  function generate_images( $meta ) {
990
  global $_wp_additional_image_sizes;
991
  $sizes = $this->get_image_sizes();
992
- if ( !isset( $meta['file'] ) )
993
- return;
994
- $originalfile = $meta['file'];
995
  $uploads = wp_upload_dir();
 
 
 
 
 
 
 
 
 
 
 
996
  $pathinfo = pathinfo( $originalfile );
997
  $original_basename = $pathinfo['basename'];
998
  $basepath = trailingslashit( $uploads['basedir'] ) . $pathinfo['dirname'];
 
999
  $ignore = get_option( "wr2x_ignore_sizes" );
1000
  if ( empty( $ignore ) )
1001
  $ignore = array();
1
  <?php
2
 
3
+ require __DIR__ . '/vendor/autoload.php';
 
4
 
5
  class Meow_WR2X_Core {
6
 
100
  function picture_rewrite( $buffer ) {
101
  if ( !isset( $buffer ) || trim( $buffer ) === '' )
102
  return $buffer;
103
+ $html = new KubAT\PhpSimple\HtmlDomParser();
104
  $lazysize = get_option( "wr2x_picturefill_lazysizes" ) && $this->admin->is_registered();
105
  $killSrc = !get_option( "wr2x_picturefill_keep_src" );
106
  $nodes_count = 0;
633
  function resize( $file_path, $width, $height, $crop, $newfile, $customCrop = false ) {
634
  $crop_params = $crop == '1' ? true : $crop;
635
  $orig_size = getimagesize( $file_path );
636
+ $image_src = array ();
637
  $image_src[0] = $file_path;
638
  $image_src[1] = $orig_size[0];
639
  $image_src[2] = $orig_size[1];
986
  return $meta;
987
  }
988
 
989
+ /**
990
+ * @param mixed[] $meta
991
+ * int width
992
+ * int height
993
+ * string file
994
+ * mixed[][] sizes
995
+ */
996
  function generate_images( $meta ) {
997
  global $_wp_additional_image_sizes;
998
  $sizes = $this->get_image_sizes();
999
+ if ( !isset( $meta['file'] ) ) return;
1000
+
 
1001
  $uploads = wp_upload_dir();
1002
+
1003
+ // Check if the full-size-retina version of the generation source exists.
1004
+ // If it exists, replace the file path and its dimensions
1005
+ if ( $retina = $this->get_retina( $uploads['basedir'] . '/' . $meta['file'] ) ) {
1006
+ $meta['file'] = substr( $retina, strlen( $uploads['basedir'] ) + 1 );
1007
+ $dim = getimagesize( $retina );
1008
+ $meta['width'] = $dim[0];
1009
+ $meta['height'] = $dim[1];
1010
+ }
1011
+
1012
+ $originalfile = $meta['file'];
1013
  $pathinfo = pathinfo( $originalfile );
1014
  $original_basename = $pathinfo['basename'];
1015
  $basepath = trailingslashit( $uploads['basedir'] ) . $pathinfo['dirname'];
1016
+
1017
  $ignore = get_option( "wr2x_ignore_sizes" );
1018
  if ( empty( $ignore ) )
1019
  $ignore = array();
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: retina, images, image, responsive, lazysizes, lazy, attachment, media, fil
4
  Requires at least: 4.4
5
  Tested up to: 5.1
6
  Requires PHP: 7.0
7
- Stable tag: 5.5.2
8
 
9
  Make your website look beautiful and crisp on modern displays by creating and displaying retina images. WP 4.4+ is also supported and enhanced.
10
 
@@ -34,7 +34,9 @@ More information and tutorial available one https://meowapps.com/wp-retina-2x/.
34
 
35
  == Changelog ==
36
 
37
- = 5.5.2 =
 
 
38
  * Fix: New version of HtmlDomParser.
39
  * Update: New dashboard.
40
 
4
  Requires at least: 4.4
5
  Tested up to: 5.1
6
  Requires PHP: 7.0
7
+ Stable tag: 5.5.3
8
 
9
  Make your website look beautiful and crisp on modern displays by creating and displaying retina images. WP 4.4+ is also supported and enhanced.
10
 
34
 
35
  == Changelog ==
36
 
37
+ = 5.5.3 =
38
+ * Fix: Usage of Composer.
39
+ * Update: If available, will use the Full-Size Retina for generating Retina thumbnails.
40
  * Fix: New version of HtmlDomParser.
41
  * Update: New dashboard.
42
 
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.5.2
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.5.2';
33
  $wr2x_retinajs = '2.0.0';
34
  $wr2x_picturefill = '3.0.2';
35
  $wr2x_lazysizes = '4.0.4';
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.3
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.3';
33
  $wr2x_retinajs = '2.0.0';
34
  $wr2x_picturefill = '3.0.2';
35
  $wr2x_lazysizes = '4.0.4';