Image Watermark - Version 1.6.3.1

Version Description

  • Fix: The plugin directory upload fix.
Download this release

Release Info

Developer dfactory
Plugin Icon 128x128 Image Watermark
Version 1.6.3.1
Comparing to
See all releases

Code changes from version 1.6.2 to 1.6.3.1

Files changed (2) hide show
  1. image-watermark.php +27 -17
  2. readme.txt +10 -4
image-watermark.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Image Watermark
4
  Description: Image Watermark allows you to automatically watermark images uploaded to the WordPress Media Library and bulk watermark previously uploaded images.
5
- Version: 1.6.2
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/image-watermark/
@@ -32,7 +32,7 @@ define( 'IMAGE_WATERMARK_PATH', plugin_dir_path( __FILE__ ) );
32
  * Image Watermark class.
33
  *
34
  * @class Image_Watermark
35
- * @version 1.6.2
36
  */
37
  final class Image_Watermark {
38
 
@@ -81,7 +81,7 @@ final class Image_Watermark {
81
  'backup_quality' => 90
82
  )
83
  ),
84
- 'version' => '1.6.2'
85
  );
86
  public $options = array();
87
 
@@ -99,7 +99,7 @@ final class Image_Watermark {
99
  $this->options = array_merge( $this->defaults['options'], $options );
100
  $this->options['watermark_image'] = array_merge( $this->defaults['options']['watermark_image'], $options['watermark_image'] );
101
  $this->options['image_protection'] = array_merge( $this->defaults['options']['image_protection'], $options['image_protection'] );
102
- $this->options['backup'] = array_merge( $this->defaults['options']['backup'], $options['backup'] );
103
 
104
  include_once( IMAGE_WATERMARK_PATH . 'includes/class-update.php' );
105
  include_once( IMAGE_WATERMARK_PATH . 'includes/class-settings.php' );
@@ -341,17 +341,21 @@ final class Image_Watermark {
341
  * Enqueue frontend script with 'no right click' and 'drag and drop' functions.
342
  */
343
  public function wp_enqueue_scripts() {
 
 
344
  if ( ($this->options['image_protection']['forlogged'] == 0 && is_user_logged_in()) || ($this->options['image_protection']['draganddrop'] == 0 && $this->options['image_protection']['rightclick'] == 0) )
345
- return;
346
-
347
- wp_enqueue_script( 'iw-no-right-click', plugins_url( 'js/no-right-click.js', __FILE__ ), array(), $this->defaults['version'] );
 
348
 
349
- wp_localize_script(
350
- 'iw-no-right-click', 'IwNRCargs', array(
351
- 'rightclick' => ($this->options['image_protection']['rightclick'] == 1 ? 'Y' : 'N'),
352
- 'draganddrop' => ($this->options['image_protection']['draganddrop'] == 1 ? 'Y' : 'N')
353
- )
354
- );
 
355
  }
356
 
357
  /**
@@ -837,7 +841,9 @@ final class Image_Watermark {
837
  $exiflength = strlen( $exifdata ) + 2;
838
 
839
  // construct EXIF segment
840
- if ( $exiflength <= 0xFFFF )
 
 
841
  $metadata['exif'] = chr( 0xFF ) . chr( 0xE1 ) . chr( ( $exiflength >> 8 ) & 0xFF ) . chr( $exiflength & 0xFF ) . $exifdata;
842
  }
843
 
@@ -848,7 +854,9 @@ final class Image_Watermark {
848
  $iptclength = strlen( $iptcdata ) + 2;
849
 
850
  // construct IPTC segment
851
- if ( $iptclength <= 0xFFFF )
 
 
852
  $metadata['iptc'] = chr( 0xFF ) . chr( 0xED ) . chr( ( $iptclength >> 8 ) & 0xFF ) . chr( $iptclength & 0xFF ) . $iptcdata;
853
  }
854
  }
@@ -864,7 +872,9 @@ final class Image_Watermark {
864
  * @return false|int
865
  */
866
  public function save_image_metadata( $metadata, $file ) {
867
- if ( file_exists( $file ) ) {
 
 
868
  $exifdata = $metadata['exif'];
869
  $iptcdata = $metadata['iptc'];
870
 
@@ -1005,7 +1015,7 @@ final class Image_Watermark {
1005
  $watermark->clear();
1006
  $watermark->destroy();
1007
  $watermark = null;
1008
- // gd extension
1009
  } else {
1010
  // get image resource
1011
  $image = $this->get_image_resource( $image_path, $mime['type'] );
2
  /*
3
  Plugin Name: Image Watermark
4
  Description: Image Watermark allows you to automatically watermark images uploaded to the WordPress Media Library and bulk watermark previously uploaded images.
5
+ Version: 1.6.3.1
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/image-watermark/
32
  * Image Watermark class.
33
  *
34
  * @class Image_Watermark
35
+ * @version 1.6.3.1
36
  */
37
  final class Image_Watermark {
38
 
81
  'backup_quality' => 90
82
  )
83
  ),
84
+ 'version' => '1.6.3.1'
85
  );
86
  public $options = array();
87
 
99
  $this->options = array_merge( $this->defaults['options'], $options );
100
  $this->options['watermark_image'] = array_merge( $this->defaults['options']['watermark_image'], $options['watermark_image'] );
101
  $this->options['image_protection'] = array_merge( $this->defaults['options']['image_protection'], $options['image_protection'] );
102
+ $this->options['backup'] = array_merge( $this->defaults['options']['backup'], isset( $options['backup'] ) ? $options['backup'] : array() );
103
 
104
  include_once( IMAGE_WATERMARK_PATH . 'includes/class-update.php' );
105
  include_once( IMAGE_WATERMARK_PATH . 'includes/class-settings.php' );
341
  * Enqueue frontend script with 'no right click' and 'drag and drop' functions.
342
  */
343
  public function wp_enqueue_scripts() {
344
+ $right_click = true;
345
+
346
  if ( ($this->options['image_protection']['forlogged'] == 0 && is_user_logged_in()) || ($this->options['image_protection']['draganddrop'] == 0 && $this->options['image_protection']['rightclick'] == 0) )
347
+ $right_click = false;
348
+
349
+ if ( apply_filters( 'iw_block_right_click', (bool) $right_click ) === true ) {
350
+ wp_enqueue_script( 'iw-no-right-click', plugins_url( 'js/no-right-click.js', __FILE__ ), array(), $this->defaults['version'] );
351
 
352
+ wp_localize_script(
353
+ 'iw-no-right-click', 'IwNRCargs', array(
354
+ 'rightclick' => ($this->options['image_protection']['rightclick'] == 1 ? 'Y' : 'N'),
355
+ 'draganddrop' => ($this->options['image_protection']['draganddrop'] == 1 ? 'Y' : 'N')
356
+ )
357
+ );
358
+ }
359
  }
360
 
361
  /**
841
  $exiflength = strlen( $exifdata ) + 2;
842
 
843
  // construct EXIF segment
844
+ if ( $exiflength > 0xFFFF ) {
845
+ return $metadata;
846
+ } else
847
  $metadata['exif'] = chr( 0xFF ) . chr( 0xE1 ) . chr( ( $exiflength >> 8 ) & 0xFF ) . chr( $exiflength & 0xFF ) . $exifdata;
848
  }
849
 
854
  $iptclength = strlen( $iptcdata ) + 2;
855
 
856
  // construct IPTC segment
857
+ if ( $iptclength > 0xFFFF ) {
858
+ return $metadata;
859
+ } else
860
  $metadata['iptc'] = chr( 0xFF ) . chr( 0xED ) . chr( ( $iptclength >> 8 ) & 0xFF ) . chr( $iptclength & 0xFF ) . $iptcdata;
861
  }
862
  }
872
  * @return false|int
873
  */
874
  public function save_image_metadata( $metadata, $file ) {
875
+ $mime = wp_check_filetype( $file );
876
+
877
+ if ( file_exists( $file ) && $mime['type'] !== 'image/png' ) {
878
  $exifdata = $metadata['exif'];
879
  $iptcdata = $metadata['iptc'];
880
 
1015
  $watermark->clear();
1016
  $watermark->destroy();
1017
  $watermark = null;
1018
+ // gd extension
1019
  } else {
1020
  // get image resource
1021
  $image = $this->get_image_resource( $image_path, $mime['type'] );
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: dfactory
3
  Donate link: http://www.dfactory.eu/
4
  Tags: image, images, picture, photo, watermark, watermarking, protection, image protection, image security, plugin
5
  Requires at least: 4.0
6
- Tested up to: 4.9.1
7
- Stable tag: 1.6.2
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -54,6 +54,12 @@ No questions yet.
54
 
55
  == Changelog ==
56
 
 
 
 
 
 
 
57
  = 1.6.2 =
58
  * New: Option to select watermark offset unit - pixels or percentages
59
  * Tweak: Added values to slider settings fields
@@ -171,5 +177,5 @@ Initial release
171
 
172
  == Upgrade Notice ==
173
 
174
- = 1.6.2 =
175
- * New: Option to select watermark offset unit - pixels or percentages
3
  Donate link: http://www.dfactory.eu/
4
  Tags: image, images, picture, photo, watermark, watermarking, protection, image protection, image security, plugin
5
  Requires at least: 4.0
6
+ Tested up to: 4.9.2
7
+ Stable tag: 1.6.3.1
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
54
 
55
  == Changelog ==
56
 
57
+ = 1.6.3.1 =
58
+ * Fix: The plugin directory upload fix.
59
+
60
+ = 1.6.3 =
61
+ * Fix: PNG files watermarking issue
62
+
63
  = 1.6.2 =
64
  * New: Option to select watermark offset unit - pixels or percentages
65
  * Tweak: Added values to slider settings fields
177
 
178
  == Upgrade Notice ==
179
 
180
+ = 1.6.3.1 =
181
+ * Fix: The plugin directory upload fix.