Image Watermark - Version 1.6.4

Version Description

  • Fix: Transparent PNG issues with ImageMagic library
Download this release

Release Info

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

Code changes from version 1.6.3.1 to 1.6.4

Files changed (2) hide show
  1. image-watermark.php +20 -7
  2. readme.txt +6 -3
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.3.1
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.3.1
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.3.1'
85
  );
86
  public $options = array();
87
 
@@ -388,7 +388,16 @@ final class Image_Watermark {
388
  } else
389
  $this->extension = $ext;
390
  }
391
-
 
 
 
 
 
 
 
 
 
392
  /**
393
  * Apply watermark everywhere or for specific post types.
394
  *
@@ -971,8 +980,12 @@ final class Image_Watermark {
971
  // create watermark resource
972
  $watermark = new Imagick( $watermark_path );
973
 
974
- // set transparency
975
- $image->setImageOpacity( round( 1 - (float) ( $options['watermark_image']['transparent'] / 100 ), 2 ) );
 
 
 
 
976
 
977
  // set compression quality
978
  if ( $mime['type'] === 'image/jpeg' ) {
@@ -1001,7 +1014,7 @@ final class Image_Watermark {
1001
  list( $dest_x, $dest_y ) = $this->calculate_image_coordinates( $image_dim['width'], $image_dim['height'], $width, $height, $options );
1002
 
1003
  // combine two images together
1004
- $image->compositeImage( $watermark, Imagick::COMPOSITE_OVERLAY, $dest_x, $dest_y, Imagick::CHANNEL_ALL );
1005
 
1006
  // save watermarked image
1007
  $image->writeImage( $image_path );
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.4
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.4
36
  */
37
  final class Image_Watermark {
38
 
81
  'backup_quality' => 90
82
  )
83
  ),
84
+ 'version' => '1.6.4'
85
  );
86
  public $options = array();
87
 
388
  } else
389
  $this->extension = $ext;
390
  }
391
+ /*
392
+ imagick 50% jpgy sa ok, watermark troche w innych kolorach, png sa przyciemnione, tak jakby mialy 50% nie na watermarku, a na calym obrazku
393
+ Imagick GD
394
+ JPG PNG JPG PNG
395
+ wp-logo-png24-transparent + - + +
396
+ wp-logo-png24-flat + - + +
397
+ wp-logo-png8-transparent + -
398
+ wp-logo-png8-flat + -
399
+ wp-logo-jpg + +
400
+ */
401
  /**
402
  * Apply watermark everywhere or for specific post types.
403
  *
980
  // create watermark resource
981
  $watermark = new Imagick( $watermark_path );
982
 
983
+ // alpha channel exists?
984
+ if ( $watermark->getImageAlphaChannel() > 0 )
985
+ $watermark->evaluateImage( Imagick::EVALUATE_MULTIPLY, round( (float) ( $options['watermark_image']['transparent'] / 100 ), 2 ), Imagick::CHANNEL_ALPHA );
986
+ // no alpha channel
987
+ else
988
+ $watermark->setImageOpacity( round( (float) ( $options['watermark_image']['transparent'] / 100 ), 2 ) );
989
 
990
  // set compression quality
991
  if ( $mime['type'] === 'image/jpeg' ) {
1014
  list( $dest_x, $dest_y ) = $this->calculate_image_coordinates( $image_dim['width'], $image_dim['height'], $width, $height, $options );
1015
 
1016
  // combine two images together
1017
+ $image->compositeImage( $watermark, Imagick::COMPOSITE_DEFAULT, $dest_x, $dest_y, Imagick::CHANNEL_ALL );
1018
 
1019
  // save watermarked image
1020
  $image->writeImage( $image_path );
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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,6 +54,9 @@ No questions yet.
54
 
55
  == Changelog ==
56
 
 
 
 
57
  = 1.6.3.1 =
58
  * Fix: The plugin directory upload fix.
59
 
@@ -177,5 +180,5 @@ Initial release
177
 
178
  == Upgrade Notice ==
179
 
180
- = 1.6.3.1 =
181
- * Fix: The plugin directory upload fix.
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.4
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
54
 
55
  == Changelog ==
56
 
57
+ = 1.6.4 =
58
+ * Fix: Transparent PNG issues with ImageMagic library
59
+
60
  = 1.6.3.1 =
61
  * Fix: The plugin directory upload fix.
62
 
180
 
181
  == Upgrade Notice ==
182
 
183
+ = 1.6.4 =
184
+ * Fix: Transparent PNG issues with ImageMagic library