Easy Watermark - Version 0.4.4

Version Description

  • repaired issue with auto-watermark option
Download this release

Release Info

Developer szaleq
Plugin Icon Easy Watermark
Version 0.4.4
Comparing to
See all releases

Code changes from version 0.4.3 to 0.4.4

index.php CHANGED
@@ -2,7 +2,7 @@
2
/*
3
Plugin Name: Easy Watermark
4
Description: This plugin can automatically add image and text watermark to pictures as they are uploaded to wordpress media library. You can also watermark existing images manually (all at once or an every single image). Watermark image can be a png, gif (alpha channel supported in both cases) or jpg. It's also possibile to set watermark opacity (doesn't apply to png with alpha channel). For text watermark you can select font, set color, size, angel and opacity.
5
- Version: 0.4.3
6
Author: Wojtek Szałkiewicz
7
Author URI: http://szalkiewicz.pl/
8
License: GPLv2 or later
2
/*
3
Plugin Name: Easy Watermark
4
Description: This plugin can automatically add image and text watermark to pictures as they are uploaded to wordpress media library. You can also watermark existing images manually (all at once or an every single image). Watermark image can be a png, gif (alpha channel supported in both cases) or jpg. It's also possibile to set watermark opacity (doesn't apply to png with alpha channel). For text watermark you can select font, set color, size, angel and opacity.
5
+ Version: 0.4.4
6
Author: Wojtek Szałkiewicz
7
Author URI: http://szalkiewicz.pl/
8
License: GPLv2 or later
languages/easy-watermark-pl_PL.mo CHANGED
Binary file
languages/easy-watermark-pl_PL.po CHANGED
@@ -3,7 +3,7 @@ msgstr ""
3
"Project-Id-Version: Easy Watermark 0.4.3\n"
4
"Report-Msgid-Bugs-To: \n"
5
"POT-Creation-Date: 2013-05-16 19:39+0100\n"
6
- "PO-Revision-Date: 2013-05-17 20:37+0100\n"
7
"Last-Translator: Wojtek Szałkiewicz <wojtek@szalkiewicz.pl>\n"
8
"Language-Team: Wojtek Szałkiewicz <wojtek@szalkiewicz.pl>\n"
9
"Language: Polish\n"
3
"Project-Id-Version: Easy Watermark 0.4.3\n"
4
"Report-Msgid-Bugs-To: \n"
5
"POT-Creation-Date: 2013-05-16 19:39+0100\n"
6
+ "PO-Revision-Date: 2013-05-26 12:17+0100\n"
7
"Last-Translator: Wojtek Szałkiewicz <wojtek@szalkiewicz.pl>\n"
8
"Language-Team: Wojtek Szałkiewicz <wojtek@szalkiewicz.pl>\n"
9
"Language: Polish\n"
lib/EWPlugin.php CHANGED
@@ -23,7 +23,7 @@ class EWPluginCore extends EWPlugable
23
/**
24
* @var string plugin version
25
*/
26
- protected static $version = '0.4.3';
27
28
/**
29
* @var string plugin class name
23
/**
24
* @var string plugin version
25
*/
26
+ protected static $version = '0.4.4';
27
28
/**
29
* @var string plugin class name
lib/EasyWatermarkPlugin.php CHANGED
@@ -332,7 +332,7 @@ EOD;
332
*/
333
public function wp_generate_attachment_metadata($metadata, $id){
334
if($this->watermark_uploaded && $this->uploaded_id == $id){
335
- $this->watermark_single($id, true);
336
337
$this->watermark_uploaded = false;
338
$this->uploaded_id = null;
@@ -347,7 +347,7 @@ EOD;
347
* @uses self::create_watermark
348
* @return boolean
349
*/
350
- private function watermark_single($id, $checkMime = false){
351
if($this->isGDEnabled()) :
352
353
if($this->settings['image']['watermark_path'] != '' || $this->settings['text']['text'] != null){
@@ -361,7 +361,7 @@ EOD;
361
return false;
362
}
363
364
- return $this->create_watermark($post);
365
}
366
else {
367
$this->error = 2;
@@ -419,11 +419,15 @@ EOD;
419
* @param object wp post
420
* @return boolean
421
*/
422
- public function create_watermark($post){
423
- $meta = get_post_meta($post->ID, '_wp_attachment_metadata');
424
- $meta = $meta[0];
425
- $images = $meta['sizes'];
426
- $images['full'] = array(
427
'file' => $meta['file'],
428
'mime-type' => $post->post_mime_type
429
);
@@ -434,7 +438,7 @@ EOD;
434
$allowedSizes = $this->settings['general']['image_sizes'];
435
436
$return = true;
437
- foreach($images as $size => $img){
438
if(in_array($size, $allowedSizes)){
439
$imgFile = str_replace($filebasename, wp_basename($img['file']), $filepath);
440
if(!$this->watermark_image($imgFile, $img['mime-type']))
332
*/
333
public function wp_generate_attachment_metadata($metadata, $id){
334
if($this->watermark_uploaded && $this->uploaded_id == $id){
335
+ $this->watermark_single($id, false, $metadata);
336
337
$this->watermark_uploaded = false;
338
$this->uploaded_id = null;
347
* @uses self::create_watermark
348
* @return boolean
349
*/
350
+ private function watermark_single($id, $checkMime = false, $meta = array()){
351
if($this->isGDEnabled()) :
352
353
if($this->settings['image']['watermark_path'] != '' || $this->settings['text']['text'] != null){
361
return false;
362
}
363
364
+ return $this->create_watermark($post, $meta);
365
}
366
else {
367
$this->error = 2;
419
* @param object wp post
420
* @return boolean
421
*/
422
+ public function create_watermark($post, $meta = array()){
423
+
424
+ if(empty($meta)){
425
+ $meta = get_post_meta($post->ID, '_wp_attachment_metadata');
426
+ $meta = $meta[0];
427
+ }
428
+
429
+ $sizes = $meta['sizes'];
430
+ $sizes['full'] = array(
431
'file' => $meta['file'],
432
'mime-type' => $post->post_mime_type
433
);
438
$allowedSizes = $this->settings['general']['image_sizes'];
439
440
$return = true;
441
+ foreach($sizes as $size => $img){
442
if(in_array($size, $allowedSizes)){
443
$imgFile = str_replace($filebasename, wp_basename($img['file']), $filepath);
444
if(!$this->watermark_image($imgFile, $img['mime-type']))
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=wojte
4
Tags: watermark, image, picture, photo, media, gallery, signature, transparent, upload, admin
5
Requires at least: 3.3
6
Tested up to: 3.5.1
7
- Stable tag: 0.4.3
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -79,6 +79,9 @@ With 'Fit to Width' or 'Fit to Height' options watermark dimensions can be set a
79
80
== Changelog ==
81
82
= 0.4.3 =
83
* added support for additional image sizes registered by some templates or plugins (e.g. 'post-thumbnail')
84
4
Tags: watermark, image, picture, photo, media, gallery, signature, transparent, upload, admin
5
Requires at least: 3.3
6
Tested up to: 3.5.1
7
+ Stable tag: 0.4.4
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
79
80
== Changelog ==
81
82
+ = 0.4.4 =
83
+ * repaired issue with auto-watermark option
84
+
85
= 0.4.3 =
86
* added support for additional image sizes registered by some templates or plugins (e.g. 'post-thumbnail')
87