Image Watermark - Version 1.6.2

Version Description

  • New: Option to select watermark offset unit - pixels or percentages
  • Tweak: Added values to slider settings fields
Download this release

Release Info

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

Code changes from version 1.6.1 to 1.6.2

css/image-watermark.css CHANGED
@@ -112,4 +112,14 @@ div.iw-notice {
112
 
113
  .delete-watermark:hover, .delete-watermark:focus, .media-frame a.delete-watermark:hover, .media-frame a.delete-watermark:focus {
114
  color: #f00;
 
 
 
 
 
 
 
 
 
 
115
  }
112
 
113
  .delete-watermark:hover, .delete-watermark:focus, .media-frame a.delete-watermark:hover, .media-frame a.delete-watermark:focus {
114
  color: #f00;
115
+ }
116
+
117
+ .iw-current-value {
118
+ position: relative;
119
+ bottom: 25px;
120
+ display: inline-block;
121
+ width: 17px;
122
+ text-align: center;
123
+ margin-left: -.6em;
124
+ font-size: 0.9em;
125
  }
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.1
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/image-watermark/
@@ -12,7 +12,7 @@ Text Domain: image-watermark
12
  Domain Path: /languages
13
 
14
  Image Watermark
15
- Copyright (C) 2013-2016, Digital Factory - info@digitalfactory.pl
16
 
17
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
18
 
@@ -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.1
36
  */
37
  final class Image_Watermark {
38
 
@@ -60,6 +60,7 @@ final class Image_Watermark {
60
  'manual_watermarking' => 0,
61
  'position' => 'bottom_right',
62
  'watermark_size_type' => 2,
 
63
  'offset_width' => 0,
64
  'offset_height' => 0,
65
  'absolute_width' => 0,
@@ -73,14 +74,14 @@ final class Image_Watermark {
73
  'image_protection' => array(
74
  'rightclick' => 0,
75
  'draganddrop' => 0,
76
- 'forlogged' => 0,
77
  ),
78
  'backup' => array(
79
  'backup_image' => true,
80
- 'backup_quality' => 90,
81
- ),
82
  ),
83
- 'version' => '1.6.1'
84
  );
85
  public $options = array();
86
 
@@ -93,7 +94,12 @@ final class Image_Watermark {
93
  register_deactivation_hook( __FILE__, array( $this, 'deactivate_watermark' ) );
94
 
95
  // settings
96
- $this->options = array_merge( $this->defaults['options'], get_option( 'image_watermark_options', $this->defaults['options'] ) );
 
 
 
 
 
97
 
98
  include_once( IMAGE_WATERMARK_PATH . 'includes/class-update.php' );
99
  include_once( IMAGE_WATERMARK_PATH . 'includes/class-settings.php' );
@@ -434,7 +440,6 @@ final class Image_Watermark {
434
  * Add watermark buttons on attachment image locations
435
  */
436
  public function attachment_fields_to_edit( $form_fields, $post ) {
437
-
438
  if ( $this->options['watermark_image']['manual_watermarking'] == 1 && $this->options['backup']['backup_image'] ) {
439
 
440
  $data = wp_get_attachment_metadata( $post->ID, false );
@@ -469,47 +474,45 @@ final class Image_Watermark {
469
  */
470
  public function watermark_action_ajax() {
471
  // Security & data check
472
- if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || ! isset( $_POST['_iw_nonce'] ) || ! isset( $_POST['iw-action'] ) || ! isset( $_POST['attachment_id'] ) || ! is_numeric( $_POST['attachment_id'] ) || ! wp_verify_nonce( $_POST['_iw_nonce'], 'image-watermark' )
473
- )
474
  wp_send_json_error( __( 'Cheatin uh?', 'image-watermark' ) );
475
 
476
  $post_id = (int) $_POST['attachment_id'];
477
  $action = false;
478
 
479
  switch ( $_POST['iw-action'] ) {
480
- case 'applywatermark': $action = 'applywatermark';
481
- break;
482
- case 'removewatermark': $action = 'removewatermark';
483
  break;
 
 
 
484
  }
485
 
486
  // only if manual watermarking is turned and we have a valid action
487
  // if the action is NOT "removewatermark" we also require a watermark image to be set
488
  if ( $post_id > 0 && $action && $this->options['watermark_image']['manual_watermarking'] == 1 && ( $this->options['watermark_image']['url'] != 0 || $action == 'removewatermark' ) ) {
489
-
490
  $data = wp_get_attachment_metadata( $post_id, false );
491
 
492
  // is this really an image?
493
  if ( in_array( get_post_mime_type( $post_id ), $this->allowed_mime_types ) && is_array( $data ) ) {
494
-
495
  if ( $action === 'applywatermark' ) {
496
  $success = $this->apply_watermark( $data, $post_id, 'manual' );
497
- if ( ! empty( $success['error'] ) ) {
 
498
  wp_send_json_success( $success['error'] );
499
- } else {
500
  wp_send_json_success( 'watermarked' );
501
- }
502
  } elseif ( $action === 'removewatermark' ) {
503
  $success = $this->remove_watermark( $data, $post_id, 'manual' );
504
- if ( $success ) {
 
505
  wp_send_json_success( 'watermarkremoved' );
506
- } else {
507
  wp_send_json_success( 'skipped' );
508
- }
509
  }
510
- } else {
511
  wp_send_json_success( 'skipped' );
512
- }
513
  }
514
 
515
  wp_send_json_error( __( 'Cheatin uh?', 'image-watermark' ) );
@@ -525,14 +528,17 @@ final class Image_Watermark {
525
 
526
  if ( $pagenow == 'upload.php' && $this->extension ) {
527
  $wp_list_table = _get_list_table( 'WP_Media_List_Table' );
528
-
529
  $action = false;
 
530
  switch ( $wp_list_table->current_action() ) {
531
- case 'applywatermark': $action = 'applywatermark';
532
- break;
533
- case 'removewatermark': $action = 'removewatermark';
534
  break;
 
 
 
535
  }
 
536
  // only if manual watermarking is turned and we have a valid action
537
  // if the action is NOT "removewatermark" we also require a watermark image to be set
538
  if ( $action && $this->options['watermark_image']['manual_watermarking'] == 1 && ( $this->options['watermark_image']['url'] != 0 || $action == 'removewatermark' ) ) {
@@ -541,20 +547,17 @@ final class Image_Watermark {
541
 
542
  $location = esc_url( remove_query_arg( array( 'watermarked', 'watermarkremoved', 'skipped', 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), wp_get_referer() ) );
543
 
544
- if ( ! $location ) {
545
  $location = 'upload.php';
546
- }
547
 
548
  $location = esc_url( add_query_arg( 'paged', $wp_list_table->get_pagenum(), $location ) );
549
 
550
  // make sure ids are submitted. depending on the resource type, this may be 'media' or 'ids'
551
- if ( isset( $_REQUEST['media'] ) ) {
552
  $post_ids = array_map( 'intval', $_REQUEST['media'] );
553
- }
554
 
555
  // do we have selected attachments?
556
  if ( $post_ids ) {
557
-
558
  $watermarked = $watermarkremoved = $skipped = 0;
559
  $messages = array();
560
 
@@ -565,24 +568,24 @@ final class Image_Watermark {
565
  if ( in_array( get_post_mime_type( $post_id ), $this->allowed_mime_types ) && is_array( $data ) ) {
566
  if ( $action === 'applywatermark' ) {
567
  $success = $this->apply_watermark( $data, $post_id, 'manual' );
568
- if ( ! empty( $success['error'] ) ) {
569
  $messages[] = $success['error'];
570
- } else {
571
- $watermarked ++;
572
  $watermarkremoved = -1;
573
  }
574
  } elseif ( $action === 'removewatermark' ) {
575
  $success = $this->remove_watermark( $data, $post_id, 'manual' );
576
- if ( $success ) {
577
- $watermarkremoved ++;
578
- } else {
579
- $skipped ++;
580
- }
 
581
  $watermarked = -1;
582
  }
583
- } else {
584
- $skipped ++;
585
- }
586
  }
587
 
588
  $location = esc_url( add_query_arg( array( 'watermarked' => $watermarked, 'watermarkremoved' => $watermarkremoved, 'skipped' => $skipped, 'messages' => $messages ), $location ), null, '' );
@@ -604,7 +607,6 @@ final class Image_Watermark {
604
  global $post_type, $pagenow;
605
 
606
  if ( $pagenow === 'upload.php' ) {
607
-
608
  if ( ! current_user_can( 'upload_files' ) )
609
  return;
610
 
@@ -618,15 +620,16 @@ final class Image_Watermark {
618
  if ( ! empty( $this->options['watermark_image']['manual_watermarking'] ) && ( ! isset( $this->options['watermark_image']['media_library_notice'] ) || $this->options['watermark_image']['media_library_notice'] === true ) ) {
619
  $mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
620
 
621
- if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], array( 'grid', 'list' ) ) ) {
622
  $mode = $_GET['mode'];
623
- }
624
 
625
  // display notice in grid mode only
626
  if ( $mode === 'grid' ) {
627
  // get current admin url
628
  $query_string = array();
 
629
  parse_str( $_SERVER['QUERY_STRING'], $query_string );
 
630
  $current_url = esc_url( add_query_arg( array_merge( (array) $query_string, array( 'iw_action' => 'hide_library_notice' ) ), '', admin_url( trailingslashit( $pagenow ) ) ) );
631
 
632
  echo '<div class="error notice"><p>' . sprintf( __( '<strong>Image Watermark:</strong> Bulk watermarking is available in list mode only, under <em>Bulk Actions</em> dropdown. <a href="%1$s">Got to List Mode</a> or <a href="%2$s">Hide this notice</a>', 'image-watermark' ), esc_url( admin_url( 'upload.php?mode=list' ) ), esc_url( $current_url ) ) . '</p></div>';
@@ -638,16 +641,15 @@ final class Image_Watermark {
638
  $watermarkremoved = (int) $_REQUEST['watermarkremoved'];
639
  $skipped = (int) $_REQUEST['skipped'];
640
 
641
- if ( $watermarked === 0 ) {
642
  echo '<div class="error"><p>' . __( 'Watermark could not be applied to selected files or no valid images (JPEG, PNG) were selected.', 'image-watermark' ) . ($skipped > 0 ? ' ' . __( 'Images skipped', 'image-watermark' ) . ': ' . $skipped . '.' : '') . '</p></div>';
643
- } elseif ( $watermarked > 0 ) {
644
  echo '<div class="updated"><p>' . sprintf( _n( 'Watermark was succesfully applied to 1 image.', 'Watermark was succesfully applied to %s images.', $watermarked, 'image-watermark' ), number_format_i18n( $watermarked ) ) . ($skipped > 0 ? ' ' . __( 'Skipped files', 'image-watermark' ) . ': ' . $skipped . '.' : '') . '</p></div>';
645
- }
646
- if ( $watermarkremoved === 0 ) {
647
  echo '<div class="error"><p>' . __( 'Watermark could not be removed from selected files or no valid images (JPEG, PNG) were selected.', 'image-watermark' ) . ($skipped > 0 ? ' ' . __( 'Images skipped', 'image-watermark' ) . ': ' . $skipped . '.' : '') . '</p></div>';
648
- } elseif ( $watermarkremoved > 0 ) {
649
  echo '<div class="updated"><p>' . sprintf( _n( 'Watermark was succesfully removed from 1 image.', 'Watermark was succesfully removed from %s images.', $watermarkremoved, 'image-watermark' ), number_format_i18n( $watermarkremoved ) ) . ($skipped > 0 ? ' ' . __( 'Skipped files', 'image-watermark' ) . ': ' . $skipped . '.' : '') . '</p></div>';
650
- }
651
 
652
  $_SERVER['REQUEST_URI'] = esc_url( remove_query_arg( array( 'watermarked', 'skipped' ), $_SERVER['REQUEST_URI'] ) );
653
  }
@@ -710,23 +712,24 @@ final class Image_Watermark {
710
  }
711
 
712
  // something went wrong or is it automatic mode?
713
- if ( $method !== 'manual' && (
714
- $this->is_admin === true && ! (
715
- ( isset( $this->options['watermark_cpt_on'][0] ) && $this->options['watermark_cpt_on'][0] === 'everywhere' ) || ( $post_id > 0 && in_array( get_post_type( $post_id ), array_keys( $this->options['watermark_cpt_on'] ) ) === true )
716
- )
717
- )
718
- )
719
  return $data;
720
 
721
  if ( apply_filters( 'iw_watermark_display', $attachment_id ) === false )
722
  return $data;
723
 
 
724
  $upload_dir = wp_upload_dir();
725
 
 
 
 
726
  // is this really an image?
727
- if ( getimagesize( $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'] ) !== false ) {
728
- // remove the watermark if this image was already watermarked, not === because the database can't hold booleans
729
- if ( get_post_meta( $attachment_id, $this->is_watermarked_metakey ) == true )
 
 
730
  $this->remove_watermark( $data, $attachment_id, 'manual' );
731
 
732
  // create a backup if this is enabled
@@ -735,31 +738,34 @@ final class Image_Watermark {
735
 
736
  // loop through active image sizes
737
  foreach ( $this->options['watermark_on'] as $image_size => $active_size ) {
738
-
739
  if ( $active_size === 1 ) {
740
  switch ( $image_size ) {
741
  case 'full':
742
- $filepath = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'];
743
  break;
744
 
745
  default:
746
  if ( ! empty( $data['sizes'] ) && array_key_exists( $image_size, $data['sizes'] ) )
747
  $filepath = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . dirname( $data['file'] ) . DIRECTORY_SEPARATOR . $data['sizes'][$image_size]['file'];
748
  else
749
- // early getaway
750
  continue 2;
751
  }
752
 
753
  do_action( 'iw_before_apply_watermark', $attachment_id, $image_size );
754
 
755
  // apply watermark
756
- $this->do_watermark( $attachment_id, $filepath, $image_size, $upload_dir );
 
 
 
757
 
758
  do_action( 'iw_after_apply_watermark', $attachment_id, $image_size );
759
  }
760
  }
 
761
  // update watermark status
762
- update_post_meta( $attachment_id, $this->is_watermarked_metakey, true );
763
  }
764
 
765
  // pass forward attachment metadata
@@ -775,15 +781,13 @@ final class Image_Watermark {
775
  * @return array
776
  */
777
  private function remove_watermark( $data, $attachment_id, $method = '' ) {
778
- if ( $method !== 'manual' ) {
779
  return $data;
780
- }
781
 
782
  $upload_dir = wp_upload_dir();
783
 
784
  // is this really an image?
785
  if ( getimagesize( $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'] ) !== false ) {
786
-
787
  // live file path (probably watermarked)
788
  $filepath = get_attached_file( $attachment_id );
789
 
@@ -796,8 +800,10 @@ final class Image_Watermark {
796
  // Failed to copy
797
  }
798
  }
 
799
  // if no backup exists, use the current full-size image to regenerate
800
  // if the "full" size is enabled for watermarks and no backup has been made the removal of watermarks can't be done
 
801
  // regenerate metadata (and thumbs)
802
  $metadata = wp_generate_attachment_metadata( $attachment_id, $filepath );
803
 
@@ -805,24 +811,139 @@ final class Image_Watermark {
805
  wp_update_attachment_metadata( $attachment_id, $metadata );
806
 
807
  // update watermark status
808
- update_post_meta( $attachment_id, $this->is_watermarked_metakey, false );
809
 
810
  // ureturn the attachment metadata
811
  return wp_get_attachment_metadata( $attachment_id );
812
  }
 
813
  return false;
814
  }
815
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
816
  /**
817
  * Apply watermark to image.
818
  *
819
  * @param int $attachment_id Attachment ID
820
  * @param string $image_path Path to the file
821
  * @param string $image_size Image size
822
- * @param array $upload_dir Upload media data
 
823
  * @return void
824
  */
825
- public function do_watermark( $attachment_id, $image_path, $image_size, $upload_dir ) {
826
  $options = apply_filters( 'iw_watermark_options', $this->options );
827
 
828
  // get image mime type
@@ -1140,8 +1261,13 @@ final class Image_Watermark {
1140
  $dest_y = ( $image_height / 2 ) - ( $watermark_height / 2 );
1141
  }
1142
 
1143
- $dest_x += $options['watermark_image']['offset_width'];
1144
- $dest_y += $options['watermark_image']['offset_height'];
 
 
 
 
 
1145
 
1146
  return array( $dest_x, $dest_y );
1147
  }
@@ -1330,4 +1456,4 @@ function Image_Watermark() {
1330
  return $instance;
1331
  }
1332
 
1333
- Image_Watermark();
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/
12
  Domain Path: /languages
13
 
14
  Image Watermark
15
+ Copyright (C) 2013-2017, Digital Factory - info@digitalfactory.pl
16
 
17
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
18
 
32
  * Image Watermark class.
33
  *
34
  * @class Image_Watermark
35
+ * @version 1.6.2
36
  */
37
  final class Image_Watermark {
38
 
60
  'manual_watermarking' => 0,
61
  'position' => 'bottom_right',
62
  'watermark_size_type' => 2,
63
+ 'offset_unit' => 'pixels',
64
  'offset_width' => 0,
65
  'offset_height' => 0,
66
  'absolute_width' => 0,
74
  'image_protection' => array(
75
  'rightclick' => 0,
76
  'draganddrop' => 0,
77
+ 'forlogged' => 0
78
  ),
79
  'backup' => array(
80
  'backup_image' => true,
81
+ 'backup_quality' => 90
82
+ )
83
  ),
84
+ 'version' => '1.6.2'
85
  );
86
  public $options = array();
87
 
94
  register_deactivation_hook( __FILE__, array( $this, 'deactivate_watermark' ) );
95
 
96
  // settings
97
+ $options = get_option( 'image_watermark_options', $this->defaults['options'] );
98
+
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' );
440
  * Add watermark buttons on attachment image locations
441
  */
442
  public function attachment_fields_to_edit( $form_fields, $post ) {
 
443
  if ( $this->options['watermark_image']['manual_watermarking'] == 1 && $this->options['backup']['backup_image'] ) {
444
 
445
  $data = wp_get_attachment_metadata( $post->ID, false );
474
  */
475
  public function watermark_action_ajax() {
476
  // Security & data check
477
+ if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || ! isset( $_POST['_iw_nonce'] ) || ! isset( $_POST['iw-action'] ) || ! isset( $_POST['attachment_id'] ) || ! is_numeric( $_POST['attachment_id'] ) || ! wp_verify_nonce( $_POST['_iw_nonce'], 'image-watermark' ) )
 
478
  wp_send_json_error( __( 'Cheatin uh?', 'image-watermark' ) );
479
 
480
  $post_id = (int) $_POST['attachment_id'];
481
  $action = false;
482
 
483
  switch ( $_POST['iw-action'] ) {
484
+ case 'applywatermark':
485
+ $action = 'applywatermark';
 
486
  break;
487
+
488
+ case 'removewatermark':
489
+ $action = 'removewatermark';
490
  }
491
 
492
  // only if manual watermarking is turned and we have a valid action
493
  // if the action is NOT "removewatermark" we also require a watermark image to be set
494
  if ( $post_id > 0 && $action && $this->options['watermark_image']['manual_watermarking'] == 1 && ( $this->options['watermark_image']['url'] != 0 || $action == 'removewatermark' ) ) {
 
495
  $data = wp_get_attachment_metadata( $post_id, false );
496
 
497
  // is this really an image?
498
  if ( in_array( get_post_mime_type( $post_id ), $this->allowed_mime_types ) && is_array( $data ) ) {
 
499
  if ( $action === 'applywatermark' ) {
500
  $success = $this->apply_watermark( $data, $post_id, 'manual' );
501
+
502
+ if ( ! empty( $success['error'] ) )
503
  wp_send_json_success( $success['error'] );
504
+ else
505
  wp_send_json_success( 'watermarked' );
 
506
  } elseif ( $action === 'removewatermark' ) {
507
  $success = $this->remove_watermark( $data, $post_id, 'manual' );
508
+
509
+ if ( $success )
510
  wp_send_json_success( 'watermarkremoved' );
511
+ else
512
  wp_send_json_success( 'skipped' );
 
513
  }
514
+ } else
515
  wp_send_json_success( 'skipped' );
 
516
  }
517
 
518
  wp_send_json_error( __( 'Cheatin uh?', 'image-watermark' ) );
528
 
529
  if ( $pagenow == 'upload.php' && $this->extension ) {
530
  $wp_list_table = _get_list_table( 'WP_Media_List_Table' );
 
531
  $action = false;
532
+
533
  switch ( $wp_list_table->current_action() ) {
534
+ case 'applywatermark':
535
+ $action = 'applywatermark';
 
536
  break;
537
+
538
+ case 'removewatermark':
539
+ $action = 'removewatermark';
540
  }
541
+
542
  // only if manual watermarking is turned and we have a valid action
543
  // if the action is NOT "removewatermark" we also require a watermark image to be set
544
  if ( $action && $this->options['watermark_image']['manual_watermarking'] == 1 && ( $this->options['watermark_image']['url'] != 0 || $action == 'removewatermark' ) ) {
547
 
548
  $location = esc_url( remove_query_arg( array( 'watermarked', 'watermarkremoved', 'skipped', 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), wp_get_referer() ) );
549
 
550
+ if ( ! $location )
551
  $location = 'upload.php';
 
552
 
553
  $location = esc_url( add_query_arg( 'paged', $wp_list_table->get_pagenum(), $location ) );
554
 
555
  // make sure ids are submitted. depending on the resource type, this may be 'media' or 'ids'
556
+ if ( isset( $_REQUEST['media'] ) )
557
  $post_ids = array_map( 'intval', $_REQUEST['media'] );
 
558
 
559
  // do we have selected attachments?
560
  if ( $post_ids ) {
 
561
  $watermarked = $watermarkremoved = $skipped = 0;
562
  $messages = array();
563
 
568
  if ( in_array( get_post_mime_type( $post_id ), $this->allowed_mime_types ) && is_array( $data ) ) {
569
  if ( $action === 'applywatermark' ) {
570
  $success = $this->apply_watermark( $data, $post_id, 'manual' );
571
+ if ( ! empty( $success['error'] ) )
572
  $messages[] = $success['error'];
573
+ else {
574
+ $watermarked++;
575
  $watermarkremoved = -1;
576
  }
577
  } elseif ( $action === 'removewatermark' ) {
578
  $success = $this->remove_watermark( $data, $post_id, 'manual' );
579
+
580
+ if ( $success )
581
+ $watermarkremoved++;
582
+ else
583
+ $skipped++;
584
+
585
  $watermarked = -1;
586
  }
587
+ } else
588
+ $skipped++;
 
589
  }
590
 
591
  $location = esc_url( add_query_arg( array( 'watermarked' => $watermarked, 'watermarkremoved' => $watermarkremoved, 'skipped' => $skipped, 'messages' => $messages ), $location ), null, '' );
607
  global $post_type, $pagenow;
608
 
609
  if ( $pagenow === 'upload.php' ) {
 
610
  if ( ! current_user_can( 'upload_files' ) )
611
  return;
612
 
620
  if ( ! empty( $this->options['watermark_image']['manual_watermarking'] ) && ( ! isset( $this->options['watermark_image']['media_library_notice'] ) || $this->options['watermark_image']['media_library_notice'] === true ) ) {
621
  $mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
622
 
623
+ if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], array( 'grid', 'list' ) ) )
624
  $mode = $_GET['mode'];
 
625
 
626
  // display notice in grid mode only
627
  if ( $mode === 'grid' ) {
628
  // get current admin url
629
  $query_string = array();
630
+
631
  parse_str( $_SERVER['QUERY_STRING'], $query_string );
632
+
633
  $current_url = esc_url( add_query_arg( array_merge( (array) $query_string, array( 'iw_action' => 'hide_library_notice' ) ), '', admin_url( trailingslashit( $pagenow ) ) ) );
634
 
635
  echo '<div class="error notice"><p>' . sprintf( __( '<strong>Image Watermark:</strong> Bulk watermarking is available in list mode only, under <em>Bulk Actions</em> dropdown. <a href="%1$s">Got to List Mode</a> or <a href="%2$s">Hide this notice</a>', 'image-watermark' ), esc_url( admin_url( 'upload.php?mode=list' ) ), esc_url( $current_url ) ) . '</p></div>';
641
  $watermarkremoved = (int) $_REQUEST['watermarkremoved'];
642
  $skipped = (int) $_REQUEST['skipped'];
643
 
644
+ if ( $watermarked === 0 )
645
  echo '<div class="error"><p>' . __( 'Watermark could not be applied to selected files or no valid images (JPEG, PNG) were selected.', 'image-watermark' ) . ($skipped > 0 ? ' ' . __( 'Images skipped', 'image-watermark' ) . ': ' . $skipped . '.' : '') . '</p></div>';
646
+ elseif ( $watermarked > 0 )
647
  echo '<div class="updated"><p>' . sprintf( _n( 'Watermark was succesfully applied to 1 image.', 'Watermark was succesfully applied to %s images.', $watermarked, 'image-watermark' ), number_format_i18n( $watermarked ) ) . ($skipped > 0 ? ' ' . __( 'Skipped files', 'image-watermark' ) . ': ' . $skipped . '.' : '') . '</p></div>';
648
+
649
+ if ( $watermarkremoved === 0 )
650
  echo '<div class="error"><p>' . __( 'Watermark could not be removed from selected files or no valid images (JPEG, PNG) were selected.', 'image-watermark' ) . ($skipped > 0 ? ' ' . __( 'Images skipped', 'image-watermark' ) . ': ' . $skipped . '.' : '') . '</p></div>';
651
+ elseif ( $watermarkremoved > 0 )
652
  echo '<div class="updated"><p>' . sprintf( _n( 'Watermark was succesfully removed from 1 image.', 'Watermark was succesfully removed from %s images.', $watermarkremoved, 'image-watermark' ), number_format_i18n( $watermarkremoved ) ) . ($skipped > 0 ? ' ' . __( 'Skipped files', 'image-watermark' ) . ': ' . $skipped . '.' : '') . '</p></div>';
 
653
 
654
  $_SERVER['REQUEST_URI'] = esc_url( remove_query_arg( array( 'watermarked', 'skipped' ), $_SERVER['REQUEST_URI'] ) );
655
  }
712
  }
713
 
714
  // something went wrong or is it automatic mode?
715
+ if ( $method !== 'manual' && ( $this->is_admin === true && ! ( ( isset( $this->options['watermark_cpt_on'][0] ) && $this->options['watermark_cpt_on'][0] === 'everywhere' ) || ( $post_id > 0 && in_array( get_post_type( $post_id ), array_keys( $this->options['watermark_cpt_on'] ) ) === true ) ) ) )
 
 
 
 
 
716
  return $data;
717
 
718
  if ( apply_filters( 'iw_watermark_display', $attachment_id ) === false )
719
  return $data;
720
 
721
+ // get upload dir data
722
  $upload_dir = wp_upload_dir();
723
 
724
+ // assign original (full) file
725
+ $original_file = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'];
726
+
727
  // is this really an image?
728
+ if ( getimagesize( $original_file, $original_image_info ) !== false ) {
729
+ $metadata = $this->get_image_metadata( $original_image_info );
730
+
731
+ // remove the watermark if this image was already watermarked
732
+ if ( (int) get_post_meta( $attachment_id, $this->is_watermarked_metakey, true ) === 1 )
733
  $this->remove_watermark( $data, $attachment_id, 'manual' );
734
 
735
  // create a backup if this is enabled
738
 
739
  // loop through active image sizes
740
  foreach ( $this->options['watermark_on'] as $image_size => $active_size ) {
 
741
  if ( $active_size === 1 ) {
742
  switch ( $image_size ) {
743
  case 'full':
744
+ $filepath = $original_file;
745
  break;
746
 
747
  default:
748
  if ( ! empty( $data['sizes'] ) && array_key_exists( $image_size, $data['sizes'] ) )
749
  $filepath = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . dirname( $data['file'] ) . DIRECTORY_SEPARATOR . $data['sizes'][$image_size]['file'];
750
  else
751
+ // early getaway
752
  continue 2;
753
  }
754
 
755
  do_action( 'iw_before_apply_watermark', $attachment_id, $image_size );
756
 
757
  // apply watermark
758
+ $this->do_watermark( $attachment_id, $filepath, $image_size, $upload_dir, $metadata );
759
+
760
+ // save metadata
761
+ $this->save_image_metadata( $metadata, $filepath );
762
 
763
  do_action( 'iw_after_apply_watermark', $attachment_id, $image_size );
764
  }
765
  }
766
+
767
  // update watermark status
768
+ update_post_meta( $attachment_id, $this->is_watermarked_metakey, 1 );
769
  }
770
 
771
  // pass forward attachment metadata
781
  * @return array
782
  */
783
  private function remove_watermark( $data, $attachment_id, $method = '' ) {
784
+ if ( $method !== 'manual' )
785
  return $data;
 
786
 
787
  $upload_dir = wp_upload_dir();
788
 
789
  // is this really an image?
790
  if ( getimagesize( $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'] ) !== false ) {
 
791
  // live file path (probably watermarked)
792
  $filepath = get_attached_file( $attachment_id );
793
 
800
  // Failed to copy
801
  }
802
  }
803
+
804
  // if no backup exists, use the current full-size image to regenerate
805
  // if the "full" size is enabled for watermarks and no backup has been made the removal of watermarks can't be done
806
+
807
  // regenerate metadata (and thumbs)
808
  $metadata = wp_generate_attachment_metadata( $attachment_id, $filepath );
809
 
811
  wp_update_attachment_metadata( $attachment_id, $metadata );
812
 
813
  // update watermark status
814
+ update_post_meta( $attachment_id, $this->is_watermarked_metakey, 0 );
815
 
816
  // ureturn the attachment metadata
817
  return wp_get_attachment_metadata( $attachment_id );
818
  }
819
+
820
  return false;
821
  }
822
 
823
+ /**
824
+ *
825
+ */
826
+ public function get_image_metadata( $imageinfo ) {
827
+ $metadata = array(
828
+ 'exif' => null,
829
+ 'iptc' => null
830
+ );
831
+
832
+ if ( is_array( $imageinfo ) ) {
833
+ // prepare EXIF data bytes from source file
834
+ $exifdata = key_exists( 'APP1', $imageinfo ) ? $imageinfo['APP1'] : null;
835
+
836
+ if ( $exifdata ) {
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
+
844
+ // prepare IPTC data bytes from source file
845
+ $iptcdata = key_exists( 'APP13', $imageinfo ) ? $imageinfo['APP13'] : null;
846
+
847
+ if ( $iptcdata ) {
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
+ }
855
+
856
+ return $metadata;
857
+ }
858
+
859
+ /**
860
+ * Save EXIF and IPTC metadata from one image to another.
861
+ *
862
+ * @param array @metadata
863
+ * @param string @destination_file
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
+
871
+ $destfilecontent = @file_get_contents( $file );
872
+
873
+ if ( ! $destfilecontent )
874
+ return false;
875
+
876
+ if ( strlen( $destfilecontent ) > 0 ) {
877
+ $destfilecontent = substr( $destfilecontent, 2 );
878
+
879
+ // variable accumulates new & original IPTC application segments
880
+ $portiontoadd = chr( 0xFF ) . chr( 0xD8 );
881
+
882
+ $exifadded = ! $exifdata;
883
+ $iptcadded = ! $iptcdata;
884
+
885
+ while ( ( substr( $destfilecontent, 0, 2 ) & 0xFFF0 ) === 0xFFE0 ) {
886
+ $segmentlen = ( substr( $destfilecontent, 2, 2 ) & 0xFFFF );
887
+
888
+ // last 4 bits of second byte is IPTC segment
889
+ $iptcsegmentnumber = ( substr( $destfilecontent, 1, 1 ) & 0x0F );
890
+
891
+ if ( $segmentlen <= 2 )
892
+ return false;
893
+
894
+ $thisexistingsegment = substr( $destfilecontent, 0, $segmentlen + 2 );
895
+
896
+ if ( ( $iptcsegmentnumber >= 1 ) && ( ! $exifadded ) ) {
897
+ $portiontoadd .= $exifdata;
898
+ $exifadded = true;
899
+
900
+ if ( $iptcsegmentnumber === 1 )
901
+ $thisexistingsegment = '';
902
+ }
903
+
904
+ if ( ( $iptcsegmentnumber >= 13 ) && ( ! $iptcadded ) ) {
905
+ $portiontoadd .= $iptcdata;
906
+ $iptcadded = true;
907
+
908
+ if ( $iptcsegmentnumber === 13 )
909
+ $thisexistingsegment = '';
910
+ }
911
+
912
+ $portiontoadd .= $thisexistingsegment;
913
+ $destfilecontent = substr( $destfilecontent, $segmentlen + 2 );
914
+ }
915
+
916
+ // add EXIF data if not added already
917
+ if ( ! $exifadded )
918
+ $portiontoadd .= $exifdata;
919
+
920
+ // add IPTC data if not added already
921
+ if ( ! $iptcadded )
922
+ $portiontoadd .= $iptcdata;
923
+
924
+ $outputfile = fopen( $file, 'w' );
925
+
926
+ if ( $outputfile )
927
+ return fwrite( $outputfile, $portiontoadd . $destfilecontent );
928
+ else
929
+ return false;
930
+ } else
931
+ return false;
932
+ } else
933
+ return false;
934
+ }
935
+
936
  /**
937
  * Apply watermark to image.
938
  *
939
  * @param int $attachment_id Attachment ID
940
  * @param string $image_path Path to the file
941
  * @param string $image_size Image size
942
+ * @param array $upload_dir Upload media data
943
+ * @param array $metadata EXIF and ITPC metadata
944
  * @return void
945
  */
946
+ public function do_watermark( $attachment_id, $image_path, $image_size, $upload_dir, $metadata = array() ) {
947
  $options = apply_filters( 'iw_watermark_options', $this->options );
948
 
949
  // get image mime type
1261
  $dest_y = ( $image_height / 2 ) - ( $watermark_height / 2 );
1262
  }
1263
 
1264
+ if ( $options['watermark_image']['offset_unit'] === 'pixels' ) {
1265
+ $dest_x += $options['watermark_image']['offset_width'];
1266
+ $dest_y += $options['watermark_image']['offset_height'];
1267
+ } else {
1268
+ $dest_x += (int) ( $image_width * $options['watermark_image']['offset_width'] / 100 );
1269
+ $dest_y += (int) ( $image_height * $options['watermark_image']['offset_height'] / 100 );
1270
+ }
1271
 
1272
  return array( $dest_x, $dest_y );
1273
  }
1456
  return $instance;
1457
  }
1458
 
1459
+ $image_watermark = Image_Watermark();
includes/class-settings.php CHANGED
@@ -56,9 +56,8 @@ class Image_Watermark_Settings {
56
  add_settings_section( 'image_watermark_general', __( 'General settings', 'image-watermark' ), '', 'image_watermark_options' );
57
 
58
  // is imagick available?
59
- if ( isset( Image_Watermark()->extensions['imagick'] ) ) {
60
  add_settings_field( 'iw_extension', __( 'PHP library', 'image-watermark' ), array( $this, 'iw_extension' ), 'image_watermark_options', 'image_watermark_general' );
61
- }
62
 
63
  add_settings_field( 'iw_automatic_watermarking', __( 'Automatic watermarking', 'image-watermark' ), array( $this, 'iw_automatic_watermarking' ), 'image_watermark_options', 'image_watermark_general' );
64
  add_settings_field( 'iw_manual_watermarking', __( 'Manual watermarking', 'image-watermark' ), array( $this, 'iw_manual_watermarking' ), 'image_watermark_options', 'image_watermark_general' );
@@ -70,6 +69,7 @@ class Image_Watermark_Settings {
70
  add_settings_section( 'image_watermark_position', __( 'Watermark position', 'image-watermark' ), '', 'image_watermark_options' );
71
  add_settings_field( 'iw_alignment', __( 'Watermark alignment', 'image-watermark' ), array( $this, 'iw_alignment' ), 'image_watermark_options', 'image_watermark_position' );
72
  add_settings_field( 'iw_offset', __( 'Watermark offset', 'image-watermark' ), array( $this, 'iw_offset' ), 'image_watermark_options', 'image_watermark_position' );
 
73
 
74
  // watermark image
75
  add_settings_section( 'image_watermark_image', __( 'Watermark image', 'image-watermark' ), '', 'image_watermark_options' );
@@ -77,7 +77,7 @@ class Image_Watermark_Settings {
77
  add_settings_field( 'iw_watermark_preview', __( 'Watermark preview', 'image-watermark' ), array( $this, 'iw_watermark_preview' ), 'image_watermark_options', 'image_watermark_image' );
78
  add_settings_field( 'iw_watermark_size', __( 'Watermark size', 'image-watermark' ), array( $this, 'iw_watermark_size' ), 'image_watermark_options', 'image_watermark_image' );
79
  add_settings_field( 'iw_watermark_size_custom', __( 'Watermark custom size', 'image-watermark' ), array( $this, 'iw_watermark_size_custom' ), 'image_watermark_options', 'image_watermark_image' );
80
- add_settings_field( 'iw_watermark_size_scaled', __( 'Scale of watermark in relation to image width', 'image-watermark' ), array( $this, 'iw_watermark_size_scaled' ), 'image_watermark_options', 'image_watermark_image' );
81
  add_settings_field( 'iw_watermark_opacity', __( 'Watermark transparency / opacity', 'image-watermark' ), array( $this, 'iw_watermark_opacity' ), 'image_watermark_options', 'image_watermark_image' );
82
  add_settings_field( 'iw_image_quality', __( 'Image quality', 'image-watermark' ), array( $this, 'iw_image_quality' ), 'image_watermark_options', 'image_watermark_image' );
83
  add_settings_field( 'iw_image_format', __( 'Image format', 'image-watermark' ), array( $this, 'iw_image_format' ), 'image_watermark_options', 'image_watermark_image' );
@@ -122,7 +122,7 @@ class Image_Watermark_Settings {
122
  <h3 class="hndle">' . __( 'Image Watermark', 'image-watermark' ) . ' ' . Image_Watermark()->defaults['version'] . '</h3>
123
  <div class="inside">
124
  <h4 class="inner">' . __( 'Need support?', 'image-watermark' ) . '</h4>
125
- <p class="inner">' . __( 'If you are having problems with this plugin, checkout plugin', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/docs/image-watermark-plugin/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=documentation" target="_blank" title="' . __( 'Documentation', 'image-watermark' ) . '">' . __( 'Documentation', 'image-watermark' ) . '</a> ' . __( 'or talk about them in the', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/support/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=support" target="_blank" title="' . __( 'Support forum', 'image-watermark' ) . '">' . __( 'Support forum', 'image-watermark' ) . '</a></p>
126
  <hr />
127
  <h4 class="inner">' . __( 'Do you like this plugin?', 'image-watermark' ) . '</h4>
128
  <p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/image-watermark" target="_blank" title="' . __( 'Rate it 5', 'image-watermark' ) . '">' . __( 'Rate it 5', 'image-watermark' ) . '</a> ' . __( 'on WordPress.org', 'image-watermark' ) . '<br />' .
@@ -133,10 +133,6 @@ class Image_Watermark_Settings {
133
  <p class="df-link inner">' . __( 'Created by', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=created-by" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="' . plugins_url( '../images/logo-dfactory.png', __FILE__ ) . '" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
134
  </div>
135
  </div>
136
- <div class="df-promo">
137
- <h4 class="inner">' . __( 'Need image optimization?', 'image-watermark' ) . '</h4>
138
- <p class="inner">' . sprintf( __( 'Speed up your site with <a href="%s" target="_blank">ShortPixel</a>. Sign up as Image Watermark user and get 50&#37; extra monthly optimizations!', 'image-watermark' ), 'https://shortpixel.com/h/af/E0IQA8M124741' ) . '</p>
139
- </div>
140
  </div>
141
  <form action="options.php" method="post">
142
  <div id="main-sortables" class="meta-box-sortables ui-sortable">';
@@ -234,6 +230,7 @@ class Image_Watermark_Settings {
234
  }
235
  $input['watermark_image']['position'] = isset( $_POST['iw_options']['watermark_image']['position'] ) && in_array( esc_attr( $_POST['iw_options']['watermark_image']['position'] ), $positions ) ? esc_attr( $_POST['iw_options']['watermark_image']['position'] ) : Image_Watermark()->defaults['options']['watermark_image']['position'];
236
 
 
237
  $input['watermark_image']['offset_width'] = isset( $_POST['iw_options']['watermark_image']['offset_width'] ) ? (int) $_POST['iw_options']['watermark_image']['offset_width'] : Image_Watermark()->defaults['options']['watermark_image']['offset_width'];
238
  $input['watermark_image']['offset_height'] = isset( $_POST['iw_options']['watermark_image']['offset_height'] ) ? (int) $_POST['iw_options']['watermark_image']['offset_height'] : Image_Watermark()->defaults['options']['watermark_image']['offset_height'];
239
  $input['watermark_image']['url'] = isset( $_POST['iw_options']['watermark_image']['url'] ) ? (int) $_POST['iw_options']['watermark_image']['url'] : Image_Watermark()->defaults['options']['watermark_image']['url'];
@@ -317,7 +314,7 @@ class Image_Watermark_Settings {
317
  ?>
318
  <label for="iw_manual_watermarking">
319
  <input id="iw_manual_watermarking" type="checkbox" <?php checked( ( ! empty( Image_Watermark()->options['watermark_image']['manual_watermarking'] ) ? 1 : 0 ), 1, true ); ?> value="1" name="iw_options[watermark_image][manual_watermarking]">
320
- <?php echo __( 'Enable Apply Watermark option for images in Media Library.', 'image-watermark' ); ?>
321
  </label>
322
  <?php
323
  }
@@ -341,7 +338,8 @@ class Image_Watermark_Settings {
341
  ?>
342
  </div>
343
  <p class="description">
344
- <?php echo __( 'Check image sizes on which watermark should appear.<br /><strong>IMPORTANT:</strong> checking full size is NOT recommended as it\'s the original image. You may need it later - for removing or changing watermark, image sizes regeneration or any other image manipulations. Use it only if you know what you are doing.', 'image-watermark' ); ?>
 
345
  </p>
346
 
347
  <?php
@@ -435,7 +433,22 @@ class Image_Watermark_Settings {
435
  }
436
  ?>
437
  </table>
438
- <p class="description"><?php echo __( 'Choose the position of watermark image.', 'image-watermark' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439
  </fieldset>
440
  <?php
441
  }
@@ -443,14 +456,15 @@ class Image_Watermark_Settings {
443
  /**
444
  * Watermark offset option.
445
  *
446
- * @return mixed
447
  */
448
  public function iw_offset() {
449
  ?>
450
  <fieldset id="iw_offset">
451
- <?php echo __( 'x:', 'image-watermark' ); ?> <input type="text" size="5" name="iw_options[watermark_image][offset_width]" value="<?php echo Image_Watermark()->options['watermark_image']['offset_width']; ?>"> <?php echo __( 'px', 'image-watermark' ); ?>
452
  <br />
453
- <?php echo __( 'y:', 'image-watermark' ); ?> <input type="text" size="5" name="iw_options[watermark_image][offset_height]" value="<?php echo Image_Watermark()->options['watermark_image']['offset_height']; ?>"> <?php echo __( 'px', 'image-watermark' ); ?>
 
454
  </fieldset>
455
  <?php
456
  }
@@ -458,7 +472,7 @@ class Image_Watermark_Settings {
458
  /**
459
  * Watermark image option.
460
  *
461
- * @return mixed
462
  */
463
  public function iw_watermark_image() {
464
  if ( Image_Watermark()->options['watermark_image']['url'] !== NULL && Image_Watermark()->options['watermark_image']['url'] != 0 ) {
@@ -525,12 +539,9 @@ class Image_Watermark_Settings {
525
  ?>
526
  <fieldset id="iw_watermark_size">
527
  <div id="watermark-type">
528
- <label for="type1"><?php _e( 'original', 'image-watermark' ); ?></label>
529
- <input type="radio" id="type1" value="0" name="iw_options[watermark_image][watermark_size_type]" <?php checked( Image_Watermark()->options['watermark_image']['watermark_size_type'], 0, true ); ?> />
530
- <label for="type2"><?php _e( 'custom', 'image-watermark' ); ?></label>
531
- <input type="radio" id="type2" value="1" name="iw_options[watermark_image][watermark_size_type]" <?php checked( Image_Watermark()->options['watermark_image']['watermark_size_type'], 1, true ); ?> />
532
- <label for="type3"><?php _e( 'scaled', 'image-watermark' ); ?></label>
533
- <input type="radio" id="type3" value="2" name="iw_options[watermark_image][watermark_size_type]" <?php checked( Image_Watermark()->options['watermark_image']['watermark_size_type'], 2, true ); ?> />
534
  </div>
535
  <p class="description"><?php _e( 'Select method of aplying watermark size.', 'image-watermark' ); ?></p>
536
  </fieldset>
@@ -564,11 +575,11 @@ class Image_Watermark_Settings {
564
  <div>
565
  <input type="text" id="iw_size_input" maxlength="3" class="hide-if-js" name="iw_options[watermark_image][width]" value="<?php echo Image_Watermark()->options['watermark_image']['width']; ?>" />
566
  <div class="wplike-slider">
567
- <span class="left hide-if-no-js">0</span><span class="middle" id="iw_size_span" title="<?php echo Image_Watermark()->options['watermark_image']['width']; ?>"></span><span class="right hide-if-no-js">100</span>
568
  </div>
569
  </div>
570
  </fieldset>
571
- <p class="description"><?php _e( 'This value will be used if "scaled" method if selected above. <br />Enter a number ranging from 0 to 100. 100 makes width of watermark image equal to width of the image it is applied to.', 'image-watermark' ); ?></p>
572
  <?php
573
  }
574
 
@@ -583,7 +594,7 @@ class Image_Watermark_Settings {
583
  <div>
584
  <input type="text" id="iw_opacity_input" maxlength="3" class="hide-if-js" name="iw_options[watermark_image][transparent]" value="<?php echo Image_Watermark()->options['watermark_image']['transparent']; ?>" />
585
  <div class="wplike-slider">
586
- <span class="left hide-if-no-js">0</span><span class="middle" id="iw_opacity_span" title="<?php echo Image_Watermark()->options['watermark_image']['transparent']; ?>"></span><span class="right hide-if-no-js">100</span>
587
  </div>
588
  </div>
589
  </fieldset>
@@ -602,7 +613,7 @@ class Image_Watermark_Settings {
602
  <div>
603
  <input type="text" id="iw_quality_input" maxlength="3" class="hide-if-js" name="iw_options[watermark_image][quality]" value="<?php echo Image_Watermark()->options['watermark_image']['quality']; ?>" />
604
  <div class="wplike-slider">
605
- <span class="left hide-if-no-js">0</span><span class="middle" id="iw_quality_span" title="<?php echo Image_Watermark()->options['watermark_image']['quality']; ?>"></span><span class="right hide-if-no-js">100</span>
606
  </div>
607
  </div>
608
  </fieldset>
@@ -619,10 +630,8 @@ class Image_Watermark_Settings {
619
  ?>
620
  <fieldset id="iw_image_format">
621
  <div id="jpeg-format">
622
- <label for="baseline"><?php _e( 'baseline', 'image-watermark' ); ?></label>
623
- <input type="radio" id="baseline" value="baseline" name="iw_options[watermark_image][jpeg_format]" <?php checked( Image_Watermark()->options['watermark_image']['jpeg_format'], 'baseline', true ); ?> />
624
- <label for="progressive"><?php _e( 'progressive', 'image-watermark' ); ?></label>
625
- <input type="radio" id="progressive" value="progressive" name="iw_options[watermark_image][jpeg_format]" <?php checked( Image_Watermark()->options['watermark_image']['jpeg_format'], 'progressive', true ); ?> />
626
  </div>
627
  </fieldset>
628
  <p class="description"><?php _e( 'Select baseline or progressive image format.', 'image-watermark' ); ?></p>
@@ -696,7 +705,7 @@ class Image_Watermark_Settings {
696
  <div>
697
  <input type="text" id="iw_backup_quality_input" maxlength="3" class="hide-if-js" name="iw_options[backup][backup_quality]" value="<?php echo Image_Watermark()->options['backup']['backup_quality']; ?>" />
698
  <div class="wplike-slider">
699
- <span class="left hide-if-no-js">0</span><span class="middle" id="iw_backup_quality_span" title="<?php echo Image_Watermark()->options['backup']['backup_quality']; ?>"></span><span class="right hide-if-no-js">100</span>
700
  </div>
701
  </div>
702
  </fieldset>
56
  add_settings_section( 'image_watermark_general', __( 'General settings', 'image-watermark' ), '', 'image_watermark_options' );
57
 
58
  // is imagick available?
59
+ if ( isset( Image_Watermark()->extensions['imagick'] ) )
60
  add_settings_field( 'iw_extension', __( 'PHP library', 'image-watermark' ), array( $this, 'iw_extension' ), 'image_watermark_options', 'image_watermark_general' );
 
61
 
62
  add_settings_field( 'iw_automatic_watermarking', __( 'Automatic watermarking', 'image-watermark' ), array( $this, 'iw_automatic_watermarking' ), 'image_watermark_options', 'image_watermark_general' );
63
  add_settings_field( 'iw_manual_watermarking', __( 'Manual watermarking', 'image-watermark' ), array( $this, 'iw_manual_watermarking' ), 'image_watermark_options', 'image_watermark_general' );
69
  add_settings_section( 'image_watermark_position', __( 'Watermark position', 'image-watermark' ), '', 'image_watermark_options' );
70
  add_settings_field( 'iw_alignment', __( 'Watermark alignment', 'image-watermark' ), array( $this, 'iw_alignment' ), 'image_watermark_options', 'image_watermark_position' );
71
  add_settings_field( 'iw_offset', __( 'Watermark offset', 'image-watermark' ), array( $this, 'iw_offset' ), 'image_watermark_options', 'image_watermark_position' );
72
+ add_settings_field( 'iw_offset_unit', __( 'Offset unit', 'image-watermark' ), array( $this, 'iw_offset_unit' ), 'image_watermark_options', 'image_watermark_position' );
73
 
74
  // watermark image
75
  add_settings_section( 'image_watermark_image', __( 'Watermark image', 'image-watermark' ), '', 'image_watermark_options' );
77
  add_settings_field( 'iw_watermark_preview', __( 'Watermark preview', 'image-watermark' ), array( $this, 'iw_watermark_preview' ), 'image_watermark_options', 'image_watermark_image' );
78
  add_settings_field( 'iw_watermark_size', __( 'Watermark size', 'image-watermark' ), array( $this, 'iw_watermark_size' ), 'image_watermark_options', 'image_watermark_image' );
79
  add_settings_field( 'iw_watermark_size_custom', __( 'Watermark custom size', 'image-watermark' ), array( $this, 'iw_watermark_size_custom' ), 'image_watermark_options', 'image_watermark_image' );
80
+ add_settings_field( 'iw_watermark_size_scaled', __( 'Watermark scale', 'image-watermark' ), array( $this, 'iw_watermark_size_scaled' ), 'image_watermark_options', 'image_watermark_image' );
81
  add_settings_field( 'iw_watermark_opacity', __( 'Watermark transparency / opacity', 'image-watermark' ), array( $this, 'iw_watermark_opacity' ), 'image_watermark_options', 'image_watermark_image' );
82
  add_settings_field( 'iw_image_quality', __( 'Image quality', 'image-watermark' ), array( $this, 'iw_image_quality' ), 'image_watermark_options', 'image_watermark_image' );
83
  add_settings_field( 'iw_image_format', __( 'Image format', 'image-watermark' ), array( $this, 'iw_image_format' ), 'image_watermark_options', 'image_watermark_image' );
122
  <h3 class="hndle">' . __( 'Image Watermark', 'image-watermark' ) . ' ' . Image_Watermark()->defaults['version'] . '</h3>
123
  <div class="inside">
124
  <h4 class="inner">' . __( 'Need support?', 'image-watermark' ) . '</h4>
125
+ <p class="inner">' . __( 'If you are having problems with this plugin, checkout plugin', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/docs/image-watermark/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=documentation" target="_blank" title="' . __( 'Documentation', 'image-watermark' ) . '">' . __( 'Documentation', 'image-watermark' ) . '</a> ' . __( 'or talk about them in the', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/support/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=support" target="_blank" title="' . __( 'Support forum', 'image-watermark' ) . '">' . __( 'Support forum', 'image-watermark' ) . '</a></p>
126
  <hr />
127
  <h4 class="inner">' . __( 'Do you like this plugin?', 'image-watermark' ) . '</h4>
128
  <p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/image-watermark" target="_blank" title="' . __( 'Rate it 5', 'image-watermark' ) . '">' . __( 'Rate it 5', 'image-watermark' ) . '</a> ' . __( 'on WordPress.org', 'image-watermark' ) . '<br />' .
133
  <p class="df-link inner">' . __( 'Created by', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=created-by" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="' . plugins_url( '../images/logo-dfactory.png', __FILE__ ) . '" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
134
  </div>
135
  </div>
 
 
 
 
136
  </div>
137
  <form action="options.php" method="post">
138
  <div id="main-sortables" class="meta-box-sortables ui-sortable">';
230
  }
231
  $input['watermark_image']['position'] = isset( $_POST['iw_options']['watermark_image']['position'] ) && in_array( esc_attr( $_POST['iw_options']['watermark_image']['position'] ), $positions ) ? esc_attr( $_POST['iw_options']['watermark_image']['position'] ) : Image_Watermark()->defaults['options']['watermark_image']['position'];
232
 
233
+ $input['watermark_image']['offset_unit'] = isset( $_POST['iw_options']['watermark_image']['offset_unit'] ) && in_array( $_POST['iw_options']['watermark_image']['offset_unit'], array( 'pixels', 'percentages' ), true ) ? $_POST['iw_options']['watermark_image']['offset_unit'] : Image_Watermark()->defaults['options']['watermark_image']['offset_unit'];
234
  $input['watermark_image']['offset_width'] = isset( $_POST['iw_options']['watermark_image']['offset_width'] ) ? (int) $_POST['iw_options']['watermark_image']['offset_width'] : Image_Watermark()->defaults['options']['watermark_image']['offset_width'];
235
  $input['watermark_image']['offset_height'] = isset( $_POST['iw_options']['watermark_image']['offset_height'] ) ? (int) $_POST['iw_options']['watermark_image']['offset_height'] : Image_Watermark()->defaults['options']['watermark_image']['offset_height'];
236
  $input['watermark_image']['url'] = isset( $_POST['iw_options']['watermark_image']['url'] ) ? (int) $_POST['iw_options']['watermark_image']['url'] : Image_Watermark()->defaults['options']['watermark_image']['url'];
314
  ?>
315
  <label for="iw_manual_watermarking">
316
  <input id="iw_manual_watermarking" type="checkbox" <?php checked( ( ! empty( Image_Watermark()->options['watermark_image']['manual_watermarking'] ) ? 1 : 0 ), 1, true ); ?> value="1" name="iw_options[watermark_image][manual_watermarking]">
317
+ <?php echo __( 'Enable Apply Watermark option for Media Library images.', 'image-watermark' ); ?>
318
  </label>
319
  <?php
320
  }
338
  ?>
339
  </div>
340
  <p class="description">
341
+ <?php echo __( 'Check the image sizes watermark will be applied to.', 'image-watermark' ); ?><br />
342
+ <?php echo __( '<strong>IMPORTANT:</strong> checking full size is NOT recommended as it\'s the original image. You may need it later - for removing or changing watermark, image sizes regeneration or any other image manipulations. Use it only if you know what you are doing.', 'image-watermark' ); ?>
343
  </p>
344
 
345
  <?php
433
  }
434
  ?>
435
  </table>
436
+ <p class="description"><?php echo __( 'Select the watermark alignment.', 'image-watermark' ); ?></p>
437
+ </fieldset>
438
+ <?php
439
+ }
440
+
441
+ /**
442
+ * Watermark offset unit option.
443
+ *
444
+ * @return void
445
+ */
446
+ public function iw_offset_unit() {
447
+ ?>
448
+ <fieldset id="iw_offset_unit">
449
+ <input type="radio" id="offset_pixels" value="pixels" name="iw_options[watermark_image][offset_unit]" <?php checked( Image_Watermark()->options['watermark_image']['offset_unit'], 'pixels', true ); ?> /><label for="offset_pixels"><?php _e( 'pixels', 'image-watermark' ); ?></label>
450
+ <input type="radio" id="offset_percentages" value="percentages" name="iw_options[watermark_image][offset_unit]" <?php checked( Image_Watermark()->options['watermark_image']['offset_unit'], 'percentages', true ); ?> /><label for="offset_percentages"><?php _e( 'percentages', 'image-watermark' ); ?></label>
451
+ <p class="description"><?php _e( 'Select the watermark offset unit.', 'image-watermark' ); ?></p>
452
  </fieldset>
453
  <?php
454
  }
456
  /**
457
  * Watermark offset option.
458
  *
459
+ * @return void
460
  */
461
  public function iw_offset() {
462
  ?>
463
  <fieldset id="iw_offset">
464
+ <?php echo __( 'x:', 'image-watermark' ); ?> <input type="number" class="small-text" name="iw_options[watermark_image][offset_width]" value="<?php echo Image_Watermark()->options['watermark_image']['offset_width']; ?>">
465
  <br />
466
+ <?php echo __( 'y:', 'image-watermark' ); ?> <input type="number" class="small-text" name="iw_options[watermark_image][offset_height]" value="<?php echo Image_Watermark()->options['watermark_image']['offset_height']; ?>">
467
+ <p class="description"><?php _e( 'Enter watermark offset value.', 'image-watermark' ); ?></p>
468
  </fieldset>
469
  <?php
470
  }
472
  /**
473
  * Watermark image option.
474
  *
475
+ * @return void
476
  */
477
  public function iw_watermark_image() {
478
  if ( Image_Watermark()->options['watermark_image']['url'] !== NULL && Image_Watermark()->options['watermark_image']['url'] != 0 ) {
539
  ?>
540
  <fieldset id="iw_watermark_size">
541
  <div id="watermark-type">
542
+ <input type="radio" id="type1" value="0" name="iw_options[watermark_image][watermark_size_type]" <?php checked( Image_Watermark()->options['watermark_image']['watermark_size_type'], 0, true ); ?> /><label for="type1"><?php _e( 'original', 'image-watermark' ); ?></label>
543
+ <input type="radio" id="type2" value="1" name="iw_options[watermark_image][watermark_size_type]" <?php checked( Image_Watermark()->options['watermark_image']['watermark_size_type'], 1, true ); ?> /><label for="type2"><?php _e( 'custom', 'image-watermark' ); ?></label>
544
+ <input type="radio" id="type3" value="2" name="iw_options[watermark_image][watermark_size_type]" <?php checked( Image_Watermark()->options['watermark_image']['watermark_size_type'], 2, true ); ?> /><label for="type3"><?php _e( 'scaled', 'image-watermark' ); ?></label>
 
 
 
545
  </div>
546
  <p class="description"><?php _e( 'Select method of aplying watermark size.', 'image-watermark' ); ?></p>
547
  </fieldset>
575
  <div>
576
  <input type="text" id="iw_size_input" maxlength="3" class="hide-if-js" name="iw_options[watermark_image][width]" value="<?php echo Image_Watermark()->options['watermark_image']['width']; ?>" />
577
  <div class="wplike-slider">
578
+ <span class="left hide-if-no-js">0</span><span class="middle" id="iw_size_span" title="<?php echo Image_Watermark()->options['watermark_image']['width']; ?>"><span class="iw-current-value" style="left: <?php echo Image_Watermark()->options['watermark_image']['width']; ?>%;"><?php echo Image_Watermark()->options['watermark_image']['width']; ?></span></span><span class="right hide-if-no-js">100</span>
579
  </div>
580
  </div>
581
  </fieldset>
582
+ <p class="description"><?php _e( 'Enter a number ranging from 0 to 100. 100 makes width of watermark image equal to width of the image it is applied to.', 'image-watermark' ); ?></p>
583
  <?php
584
  }
585
 
594
  <div>
595
  <input type="text" id="iw_opacity_input" maxlength="3" class="hide-if-js" name="iw_options[watermark_image][transparent]" value="<?php echo Image_Watermark()->options['watermark_image']['transparent']; ?>" />
596
  <div class="wplike-slider">
597
+ <span class="left hide-if-no-js">0</span><span class="middle" id="iw_opacity_span" title="<?php echo Image_Watermark()->options['watermark_image']['transparent']; ?>"><span class="iw-current-value" style="left: <?php echo Image_Watermark()->options['watermark_image']['transparent']; ?>%;"><?php echo Image_Watermark()->options['watermark_image']['transparent']; ?></span></span><span class="right hide-if-no-js">100</span>
598
  </div>
599
  </div>
600
  </fieldset>
613
  <div>
614
  <input type="text" id="iw_quality_input" maxlength="3" class="hide-if-js" name="iw_options[watermark_image][quality]" value="<?php echo Image_Watermark()->options['watermark_image']['quality']; ?>" />
615
  <div class="wplike-slider">
616
+ <span class="left hide-if-no-js">0</span><span class="middle" id="iw_quality_span" title="<?php echo Image_Watermark()->options['watermark_image']['quality']; ?>"><span class="iw-current-value" style="left: <?php echo Image_Watermark()->options['watermark_image']['quality']; ?>%;"><?php echo Image_Watermark()->options['watermark_image']['quality']; ?></span></span><span class="right hide-if-no-js">100</span>
617
  </div>
618
  </div>
619
  </fieldset>
630
  ?>
631
  <fieldset id="iw_image_format">
632
  <div id="jpeg-format">
633
+ <input type="radio" id="baseline" value="baseline" name="iw_options[watermark_image][jpeg_format]" <?php checked( Image_Watermark()->options['watermark_image']['jpeg_format'], 'baseline', true ); ?> /><label for="baseline"><?php _e( 'baseline', 'image-watermark' ); ?></label>
634
+ <input type="radio" id="progressive" value="progressive" name="iw_options[watermark_image][jpeg_format]" <?php checked( Image_Watermark()->options['watermark_image']['jpeg_format'], 'progressive', true ); ?> /><label for="progressive"><?php _e( 'progressive', 'image-watermark' ); ?></label>
 
 
635
  </div>
636
  </fieldset>
637
  <p class="description"><?php _e( 'Select baseline or progressive image format.', 'image-watermark' ); ?></p>
705
  <div>
706
  <input type="text" id="iw_backup_quality_input" maxlength="3" class="hide-if-js" name="iw_options[backup][backup_quality]" value="<?php echo Image_Watermark()->options['backup']['backup_quality']; ?>" />
707
  <div class="wplike-slider">
708
+ <span class="left hide-if-no-js">0</span><span class="middle" id="iw_backup_quality_span" title="<?php echo Image_Watermark()->options['backup']['backup_quality']; ?>"><span class="iw-current-value" style="left: <?php echo Image_Watermark()->options['backup']['backup_quality']; ?>%;"><?php echo Image_Watermark()->options['backup']['backup_quality']; ?></span></span><span class="right hide-if-no-js">100</span>
709
  </div>
710
  </div>
711
  </fieldset>
js/admin-settings.js CHANGED
@@ -2,67 +2,87 @@ jQuery( document ).ready( function ( $ ) {
2
 
3
  // enable watermark for
4
  $( document ).on( 'change', '#df_option_everywhere, #df_option_cpt', function () {
5
- if ( $( '#cpt-specific input[type=radio]:checked' ).val() === 'everywhere' ) {
6
- $( '#cpt-select' ).fadeOut( 300 );
7
- } else if ( $( '#cpt-specific input[type=radio]:checked' ).val() === 'specific' ) {
8
- $( '#cpt-select' ).fadeIn( 300 );
9
- }
10
- } );
11
 
12
- $( document ).on( 'click', '#reset_image_watermark_options', function () {
13
- return confirm( iwArgs.resetToDefaults );
14
  } );
15
 
16
  // size slider
17
  $( '#iw_size_span' ).slider( {
18
- value: $( '#iw_size_input' ).val(),
19
- min: 0,
20
- max: 100,
21
- step: 1,
22
- orientation: 'horizontal',
23
- slide: function ( e, ui ) {
24
- $( '#iw_size_input' ).attr( 'value', ui.value );
25
- $( '#iw_size_span' ).attr( 'title', ui.value );
26
- }
 
 
 
 
 
27
  } );
28
 
29
  // opacity slider
30
  $( '#iw_opacity_span' ).slider( {
31
- value: $( '#iw_opacity_input' ).val(),
32
- min: 0,
33
- max: 100,
34
- step: 1,
35
- orientation: 'horizontal',
36
- slide: function ( e, ui ) {
37
- $( '#iw_opacity_input' ).attr( 'value', ui.value );
38
- $( '#iw_opacity_span' ).attr( 'title', ui.value );
39
- }
 
 
 
 
 
40
  } );
41
 
42
  // quality slider
43
  $( '#iw_quality_span' ).slider( {
44
- value: $( '#iw_quality_input' ).val(),
45
- min: 0,
46
- max: 100,
47
- step: 1,
48
- orientation: 'horizontal',
49
- slide: function ( e, ui ) {
50
- $( '#iw_quality_input' ).attr( 'value', ui.value );
51
- $( '#iw_quality_span' ).attr( 'title', ui.value );
52
- }
 
 
 
 
 
53
  } );
54
 
55
  // quality slider
56
  $( '#iw_backup_quality_span' ).slider( {
57
- value: $( '#iw_backup_quality_input' ).val(),
58
- min: 0,
59
- max: 100,
60
- step: 1,
61
- orientation: 'horizontal',
62
- slide: function ( e, ui ) {
63
- $( '#iw_backup_quality_input' ).attr( 'value', ui.value );
64
- $( '#iw_backup_quality_span' ).attr( 'title', ui.value );
65
- }
 
 
 
 
 
66
  } );
67
 
68
  } );
2
 
3
  // enable watermark for
4
  $( document ).on( 'change', '#df_option_everywhere, #df_option_cpt', function () {
5
+ if ( $( '#cpt-specific input[type=radio]:checked' ).val() === 'everywhere' ) {
6
+ $( '#cpt-select' ).fadeOut( 300 );
7
+ } else if ( $( '#cpt-specific input[type=radio]:checked' ).val() === 'specific' ) {
8
+ $( '#cpt-select' ).fadeIn( 300 );
9
+ }
10
+ } );
11
 
12
+ $( document ).on( 'click', '#reset_image_watermark_options', function () {
13
+ return confirm( iwArgs.resetToDefaults );
14
  } );
15
 
16
  // size slider
17
  $( '#iw_size_span' ).slider( {
18
+ value: $( '#iw_size_input' ).val(),
19
+ min: 0,
20
+ max: 100,
21
+ step: 1,
22
+ orientation: 'horizontal',
23
+ slide: function ( e, ui ) {
24
+ $( '#iw_size_input' ).attr( 'value', ui.value );
25
+ $( '#iw_size_span' ).attr( 'title', ui.value );
26
+
27
+ var element = $( ui.handle ).prev( '.iw-current-value' );
28
+
29
+ element.text( ui.value );
30
+ element.css( 'left', ui.value + '%' );
31
+ }
32
  } );
33
 
34
  // opacity slider
35
  $( '#iw_opacity_span' ).slider( {
36
+ value: $( '#iw_opacity_input' ).val(),
37
+ min: 0,
38
+ max: 100,
39
+ step: 1,
40
+ orientation: 'horizontal',
41
+ slide: function ( e, ui ) {
42
+ $( '#iw_opacity_input' ).attr( 'value', ui.value );
43
+ $( '#iw_opacity_span' ).attr( 'title', ui.value );
44
+
45
+ var element = $( ui.handle ).prev( '.iw-current-value' );
46
+
47
+ element.text( ui.value );
48
+ element.css( 'left', ui.value + '%' );
49
+ }
50
  } );
51
 
52
  // quality slider
53
  $( '#iw_quality_span' ).slider( {
54
+ value: $( '#iw_quality_input' ).val(),
55
+ min: 0,
56
+ max: 100,
57
+ step: 1,
58
+ orientation: 'horizontal',
59
+ slide: function ( e, ui ) {
60
+ $( '#iw_quality_input' ).attr( 'value', ui.value );
61
+ $( '#iw_quality_span' ).attr( 'title', ui.value );
62
+
63
+ var element = $( ui.handle ).prev( '.iw-current-value' );
64
+
65
+ element.text( ui.value );
66
+ element.css( 'left', ui.value + '%' );
67
+ }
68
  } );
69
 
70
  // quality slider
71
  $( '#iw_backup_quality_span' ).slider( {
72
+ value: $( '#iw_backup_quality_input' ).val(),
73
+ min: 0,
74
+ max: 100,
75
+ step: 1,
76
+ orientation: 'horizontal',
77
+ slide: function ( e, ui ) {
78
+ $( '#iw_backup_quality_input' ).attr( 'value', ui.value );
79
+ $( '#iw_backup_quality_span' ).attr( 'title', ui.value );
80
+
81
+ var element = $( ui.handle ).prev( '.iw-current-value' );
82
+
83
+ element.text( ui.value );
84
+ element.css( 'left', ui.value + '%' );
85
+ }
86
  } );
87
 
88
  } );
js/no-right-click.js CHANGED
@@ -14,244 +14,244 @@ var IwNRCextra = IwNRCargs.rightclick;
14
  var IwNRCdrag = IwNRCargs.draganddrop;
15
 
16
  function IwNRCdragdropAll( event ) {
17
- try {
18
- var ev = event || window.event;
19
- var targ = ev.srcElement || ev.target;
20
- if ( targ.tagName.toUpperCase() == "A" ) {
21
- // is this IE and are we dragging a link to the image?
22
- var hr = targ.href;
23
- hr = hr.toUpperCase();
24
- if ( hr.indexOf( '.JPG' ) || hr.indexOf( '.PNG' ) || hr.indexOf( '.GIF' ) ) {
 
 
 
 
 
 
 
 
 
 
25
  ev.returnValue = false;
26
  if ( ev.preventDefault ) {
27
- ev.preventDefault();
28
  }
29
  IwNRCinContext = false;
30
  return false;
31
- }
32
- }
33
- if ( targ.tagName.toUpperCase() != "IMG" )
34
- return true;
35
- ev.returnValue = false;
36
- if ( ev.preventDefault ) {
37
- ev.preventDefault();
38
  }
39
- IwNRCinContext = false;
40
- return false;
41
- } catch ( er ) {
42
- // alert(er);
43
- }
44
- return true;
45
  }
46
 
47
  function IwNRCdragdrop( event ) {
48
- // I am beginning to doubt if this event ever fires
49
- try {
50
- var ev = event || window.event;
51
- var targ = ev.srcElement || ev.target;
52
- ev.returnValue = false;
53
- if ( ev.preventDefault ) {
54
- ev.preventDefault();
 
 
 
 
 
 
55
  }
56
- ev.returnValue = false;
57
- IwNRCinContext = false;
58
- return false;
59
- } catch ( er ) {
60
- // alert(er);
61
- }
62
- return true;
63
  }
64
 
65
  function IwNRCcontext( event ) {
66
- try {
67
- IwNRCinContext = true;
68
- var ev = event || window.event;
69
- var targ = ev.srcElement || ev.target;
70
- IwNRCreplace( targ );
71
- ev.returnValue = false;
72
- if ( ev.preventDefault ) {
73
- ev.preventDefault();
 
 
 
 
 
74
  }
75
- ev.returnValue = false;
76
- IwNRCtargImg = targ;
77
- } catch ( er ) {
78
- // alert(er);
79
- }
80
- return false;
81
  }
82
 
83
  function IwNRCcontextAll( event ) {
84
- try {
85
- if ( IwNRCtargImg == null ) {
86
- return true;
87
- }
88
- IwNRCinContext = true;
89
- var ev = event || window.event;
90
- var targ = ev.srcElement || ev.target;
91
- if ( targ.tagName.toUpperCase() == "IMG" ) {
92
- ev.returnValue = false;
93
- if ( ev.preventDefault ) {
94
- ev.preventDefault();
95
- }
96
- ev.returnValue = false;
97
- IwNRCreplace( targ );
98
- return false;
 
 
 
 
99
  }
100
- return true;
101
- } catch ( er ) {
102
- // alert(er);
103
- }
104
- return false;
105
  }
106
 
107
  function IwNRCmousedown( event ) {
108
- try {
109
- IwNRCinContext = false;
110
- var ev = event || window.event;
111
- var targ = ev.srcElement || ev.target;
112
- if ( ev.button == 2 ) {
113
- IwNRCreplace( targ );
114
- return false;
115
- }
116
- IwNRCtargImg = targ;
117
- if ( IwNRCdrag == 'Y' ) {
118
- if ( ev.preventDefault ) {
119
- ev.preventDefault();
120
- }
 
 
 
 
121
  }
122
  return true;
123
- } catch ( er ) {
124
- // alert(er);
125
- }
126
- return true;
127
  }
128
 
129
  function IwNRCmousedownAll( event ) {
130
- try {
131
- IwNRCinContext = false;
132
- var ev = event || window.event;
133
- var targ = ev.srcElement || ev.target;
134
- if ( targ.style.backgroundImage != '' && ev.button == 2 ) {
135
- targ.oncontextmenu = function ( event ) {
136
- return false;
137
- } // iffy - might not work
138
- }
139
- if ( targ.tagName.toUpperCase() == "IMG" ) {
140
- if ( ev.button == 2 ) {
141
- IwNRCreplace( targ );
142
- return false;
143
- }
144
- if ( IwNRCdrag == 'Y' ) {
145
- if ( ev.preventDefault ) {
146
- ev.preventDefault();
 
 
 
147
  }
148
- }
149
- IwNRCtargImg = targ;
 
150
  }
151
  return true;
152
- } catch ( er ) {
153
- // alert(er);
154
- }
155
- return true;
156
  }
157
 
158
  function IwNRCreplace( targ ) {
159
- return false;
160
- if ( IwNRCtargImg != null && IwNRCtargImg.src == IwNRCnotimage.src ) {
161
- // restore the old image before hiding this one
162
- IwNRCtargImg.src = IwNRCtargSrc;
163
- IwNRCtargImg = null;
164
- IwNRCtargSrc = null;
165
- }
166
- IwNRCtargImg = targ;
167
- if ( IwNRCextra != 'Y' )
168
- return;
169
- var w = targ.width + '';
170
- var h = targ.height + '';
171
- if ( w.indexOf( 'px' ) <= 0 )
172
- w = w + 'px';
173
- if ( h.indexOf( 'px' ) <= 0 )
174
- h = h + 'px';
175
- IwNRCtargSrc = targ.src;
176
- targ.src = IwNRCnotimage.src;
177
- targ.style.width = w;
178
- targ.style.height = h;
179
- IwNRClimit = 0;
180
- var t = setTimeout( "IwNRCrestore()", 500 );
181
- return false;
182
  }
183
 
184
  function IwNRCrestore() {
185
- if ( IwNRCinContext ) {
186
- if ( IwNRClimit <= 20 ) {
187
- IwNRClimit++;
188
- var t = setTimeout( "IwNRCrestore()", 500 );
189
- return;
 
190
  }
191
- }
192
- IwNRClimit = 0;
193
- if ( IwNRCtargImg == null )
194
- return;
195
- if ( IwNRCtargSrc == null )
 
 
 
196
  return;
197
- IwNRCtargImg.src = IwNRCtargSrc;
198
- IwNRCtargImg = null;
199
- IwNRCtargSrc = null;
200
- return;
201
  }
202
 
203
  // set the image onclick event
204
  // need to check for dblclick to see if there is a right double click in IE
205
  function IwNRCaction( event ) {
206
- try {
207
- document.onmousedown = function ( event ) {
208
- return IwNRCmousedownAll( event );
209
- }
210
- document.oncontextmenu = function ( event ) {
211
- return IwNRCcontextAll( event );
212
- }
213
- document.oncopy = function ( event ) {
214
- return IwNRCcontextAll( event );
215
- }
216
- if ( IwNRCdrag == 'Y' )
217
- document.ondragstart = function ( event ) {
218
- return IwNRCdragdropAll( event );
219
- }
220
- var b = document.getElementsByTagName( "IMG" );
221
- for ( var i = 0; i < b.length; i++ ) {
222
- b[i].oncontextmenu = function ( event ) {
223
- return IwNRCcontext( event );
224
- }
225
- b[i].oncopy = function ( event ) {
226
- return IwNRCcontext( event );
227
- }
228
- b[i].onmousedown = function ( event ) {
229
- return IwNRCmousedown( event );
230
- }
231
- if ( IwNRCdrag == 'Y' )
232
- b[i].ondragstart = function ( event ) {
233
- return IwNRCdragdrop( event );
234
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  }
236
- } catch ( er ) {
237
- return false;
238
- }
239
  }
240
 
241
  if ( document.addEventListener ) {
242
- document.addEventListener( "DOMContentLoaded", function ( event ) {
243
- IwNRCaction( event );
244
- }, false );
245
  } else if ( window.attachEvent ) {
246
- window.attachEvent( "onload", function ( event ) {
247
- IwNRCaction( event );
248
- } );
249
  } else {
250
- var oldFunc = window.onload;
251
- window.onload = function () {
252
- if ( oldFunc ) {
253
- oldFunc();
254
- }
255
- IwNRCaction( 'load' );
256
- };
257
  }
14
  var IwNRCdrag = IwNRCargs.draganddrop;
15
 
16
  function IwNRCdragdropAll( event ) {
17
+ try {
18
+ var ev = event || window.event;
19
+ var targ = ev.srcElement || ev.target;
20
+ if ( targ.tagName.toUpperCase() == "A" ) {
21
+ // is this IE and are we dragging a link to the image?
22
+ var hr = targ.href;
23
+ hr = hr.toUpperCase();
24
+ if ( hr.indexOf( '.JPG' ) || hr.indexOf( '.PNG' ) || hr.indexOf( '.GIF' ) ) {
25
+ ev.returnValue = false;
26
+ if ( ev.preventDefault ) {
27
+ ev.preventDefault();
28
+ }
29
+ IwNRCinContext = false;
30
+ return false;
31
+ }
32
+ }
33
+ if ( targ.tagName.toUpperCase() != "IMG" )
34
+ return true;
35
  ev.returnValue = false;
36
  if ( ev.preventDefault ) {
37
+ ev.preventDefault();
38
  }
39
  IwNRCinContext = false;
40
  return false;
41
+ } catch ( er ) {
42
+ // alert(er);
 
 
 
 
 
43
  }
44
+ return true;
 
 
 
 
 
45
  }
46
 
47
  function IwNRCdragdrop( event ) {
48
+ // I am beginning to doubt if this event ever fires
49
+ try {
50
+ var ev = event || window.event;
51
+ var targ = ev.srcElement || ev.target;
52
+ ev.returnValue = false;
53
+ if ( ev.preventDefault ) {
54
+ ev.preventDefault();
55
+ }
56
+ ev.returnValue = false;
57
+ IwNRCinContext = false;
58
+ return false;
59
+ } catch ( er ) {
60
+ // alert(er);
61
  }
62
+ return true;
 
 
 
 
 
 
63
  }
64
 
65
  function IwNRCcontext( event ) {
66
+ try {
67
+ IwNRCinContext = true;
68
+ var ev = event || window.event;
69
+ var targ = ev.srcElement || ev.target;
70
+ IwNRCreplace( targ );
71
+ ev.returnValue = false;
72
+ if ( ev.preventDefault ) {
73
+ ev.preventDefault();
74
+ }
75
+ ev.returnValue = false;
76
+ IwNRCtargImg = targ;
77
+ } catch ( er ) {
78
+ // alert(er);
79
  }
80
+ return false;
 
 
 
 
 
81
  }
82
 
83
  function IwNRCcontextAll( event ) {
84
+ try {
85
+ if ( IwNRCtargImg == null ) {
86
+ return true;
87
+ }
88
+ IwNRCinContext = true;
89
+ var ev = event || window.event;
90
+ var targ = ev.srcElement || ev.target;
91
+ if ( targ.tagName.toUpperCase() == "IMG" ) {
92
+ ev.returnValue = false;
93
+ if ( ev.preventDefault ) {
94
+ ev.preventDefault();
95
+ }
96
+ ev.returnValue = false;
97
+ IwNRCreplace( targ );
98
+ return false;
99
+ }
100
+ return true;
101
+ } catch ( er ) {
102
+ // alert(er);
103
  }
104
+ return false;
 
 
 
 
105
  }
106
 
107
  function IwNRCmousedown( event ) {
108
+ try {
109
+ IwNRCinContext = false;
110
+ var ev = event || window.event;
111
+ var targ = ev.srcElement || ev.target;
112
+ if ( ev.button == 2 ) {
113
+ IwNRCreplace( targ );
114
+ return false;
115
+ }
116
+ IwNRCtargImg = targ;
117
+ if ( IwNRCdrag == 'Y' ) {
118
+ if ( ev.preventDefault ) {
119
+ ev.preventDefault();
120
+ }
121
+ }
122
+ return true;
123
+ } catch ( er ) {
124
+ // alert(er);
125
  }
126
  return true;
 
 
 
 
127
  }
128
 
129
  function IwNRCmousedownAll( event ) {
130
+ try {
131
+ IwNRCinContext = false;
132
+ var ev = event || window.event;
133
+ var targ = ev.srcElement || ev.target;
134
+ if ( targ.style.backgroundImage != '' && ev.button == 2 ) {
135
+ targ.oncontextmenu = function ( event ) {
136
+ return false;
137
+ } // iffy - might not work
138
+ }
139
+ if ( targ.tagName.toUpperCase() == "IMG" ) {
140
+ if ( ev.button == 2 ) {
141
+ IwNRCreplace( targ );
142
+ return false;
143
+ }
144
+ if ( IwNRCdrag == 'Y' ) {
145
+ if ( ev.preventDefault ) {
146
+ ev.preventDefault();
147
+ }
148
+ }
149
+ IwNRCtargImg = targ;
150
  }
151
+ return true;
152
+ } catch ( er ) {
153
+ // alert(er);
154
  }
155
  return true;
 
 
 
 
156
  }
157
 
158
  function IwNRCreplace( targ ) {
159
+ return false;
160
+ if ( IwNRCtargImg != null && IwNRCtargImg.src == IwNRCnotimage.src ) {
161
+ // restore the old image before hiding this one
162
+ IwNRCtargImg.src = IwNRCtargSrc;
163
+ IwNRCtargImg = null;
164
+ IwNRCtargSrc = null;
165
+ }
166
+ IwNRCtargImg = targ;
167
+ if ( IwNRCextra != 'Y' )
168
+ return;
169
+ var w = targ.width + '';
170
+ var h = targ.height + '';
171
+ if ( w.indexOf( 'px' ) <= 0 )
172
+ w = w + 'px';
173
+ if ( h.indexOf( 'px' ) <= 0 )
174
+ h = h + 'px';
175
+ IwNRCtargSrc = targ.src;
176
+ targ.src = IwNRCnotimage.src;
177
+ targ.style.width = w;
178
+ targ.style.height = h;
179
+ IwNRClimit = 0;
180
+ var t = setTimeout( "IwNRCrestore()", 500 );
181
+ return false;
182
  }
183
 
184
  function IwNRCrestore() {
185
+ if ( IwNRCinContext ) {
186
+ if ( IwNRClimit <= 20 ) {
187
+ IwNRClimit++;
188
+ var t = setTimeout( "IwNRCrestore()", 500 );
189
+ return;
190
+ }
191
  }
192
+ IwNRClimit = 0;
193
+ if ( IwNRCtargImg == null )
194
+ return;
195
+ if ( IwNRCtargSrc == null )
196
+ return;
197
+ IwNRCtargImg.src = IwNRCtargSrc;
198
+ IwNRCtargImg = null;
199
+ IwNRCtargSrc = null;
200
  return;
 
 
 
 
201
  }
202
 
203
  // set the image onclick event
204
  // need to check for dblclick to see if there is a right double click in IE
205
  function IwNRCaction( event ) {
206
+ try {
207
+ document.onmousedown = function ( event ) {
208
+ return IwNRCmousedownAll( event );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  }
210
+ document.oncontextmenu = function ( event ) {
211
+ return IwNRCcontextAll( event );
212
+ }
213
+ document.oncopy = function ( event ) {
214
+ return IwNRCcontextAll( event );
215
+ }
216
+ if ( IwNRCdrag == 'Y' )
217
+ document.ondragstart = function ( event ) {
218
+ return IwNRCdragdropAll( event );
219
+ }
220
+ var b = document.getElementsByTagName( "IMG" );
221
+ for ( var i = 0; i < b.length; i++ ) {
222
+ b[i].oncontextmenu = function ( event ) {
223
+ return IwNRCcontext( event );
224
+ }
225
+ b[i].oncopy = function ( event ) {
226
+ return IwNRCcontext( event );
227
+ }
228
+ b[i].onmousedown = function ( event ) {
229
+ return IwNRCmousedown( event );
230
+ }
231
+ if ( IwNRCdrag == 'Y' )
232
+ b[i].ondragstart = function ( event ) {
233
+ return IwNRCdragdrop( event );
234
+ }
235
+ }
236
+ } catch ( er ) {
237
+ return false;
238
  }
 
 
 
239
  }
240
 
241
  if ( document.addEventListener ) {
242
+ document.addEventListener( "DOMContentLoaded", function ( event ) {
243
+ IwNRCaction( event );
244
+ }, false );
245
  } else if ( window.attachEvent ) {
246
+ window.attachEvent( "onload", function ( event ) {
247
+ IwNRCaction( event );
248
+ } );
249
  } else {
250
+ var oldFunc = window.onload;
251
+ window.onload = function () {
252
+ if ( oldFunc ) {
253
+ oldFunc();
254
+ }
255
+ IwNRCaction( 'load' );
256
+ };
257
  }
languages/image-watermark.pot CHANGED
@@ -2,7 +2,7 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: WordPress Watermark\n"
5
- "POT-Creation-Date: 2016-12-22 13:03+0100\n"
6
  "PO-Revision-Date: 2015-05-15 19:55+0100\n"
7
  "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
8
  "Language-Team: dFactory <info@dfactory.pl>\n"
@@ -10,7 +10,7 @@ msgstr ""
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
- "X-Generator: Poedit 1.8.11\n"
14
  "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;esc_attr__;esc_attr_e;"
15
  "_n:1,2\n"
16
  "X-Poedit-Basepath: .\n"
@@ -18,103 +18,102 @@ msgstr ""
18
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
19
  "X-Poedit-SearchPath-0: ..\n"
20
 
21
- #: ../image-watermark.php:245 ../image-watermark.php:450
22
  msgid "Apply watermark"
23
  msgstr ""
24
 
25
- #: ../image-watermark.php:248 ../image-watermark.php:450
26
  msgid "Remove watermark"
27
  msgstr ""
28
 
29
- #: ../image-watermark.php:282
30
  msgid "Select watermark"
31
  msgstr ""
32
 
33
- #: ../image-watermark.php:283 ../includes/class-settings.php:511
34
  msgid "Original size"
35
  msgstr ""
36
 
37
- #: ../image-watermark.php:284 ../includes/class-settings.php:507
38
  msgid "Watermak has not been selected yet."
39
  msgstr ""
40
 
41
- #: ../image-watermark.php:285
42
  msgid "This image is not supported as watermark. Use JPEG, PNG or GIF."
43
  msgstr ""
44
 
45
- #: ../image-watermark.php:286 ../includes/class-settings.php:451
46
- #: ../includes/class-settings.php:453 ../includes/class-settings.php:511
47
- #: ../includes/class-settings.php:548 ../includes/class-settings.php:550
48
  msgid "px"
49
  msgstr ""
50
 
51
- #: ../image-watermark.php:288
52
  msgid "Add watermark"
53
  msgstr ""
54
 
55
- #: ../image-watermark.php:297
56
  msgid "Are you sure you want to reset settings to defaults?"
57
  msgstr ""
58
 
59
- #: ../image-watermark.php:320 ../image-watermark.php:642
60
  msgid ""
61
  "Watermark could not be applied to selected files or no valid images (JPEG, "
62
  "PNG) were selected."
63
  msgstr ""
64
 
65
- #: ../image-watermark.php:321 ../image-watermark.php:644
66
  #, php-format
67
  msgid "Watermark was succesfully applied to 1 image."
68
  msgid_plural "Watermark was succesfully applied to %s images."
69
  msgstr[0] ""
70
  msgstr[1] ""
71
 
72
- #: ../image-watermark.php:322
73
  #, php-format
74
  msgid "Watermark was succesfully applied to %s images."
75
  msgstr ""
76
 
77
- #: ../image-watermark.php:323 ../image-watermark.php:647
78
  msgid ""
79
  "Watermark could not be removed from selected files or no valid images (JPEG, "
80
  "PNG) were selected."
81
  msgstr ""
82
 
83
- #: ../image-watermark.php:324 ../image-watermark.php:649
84
  #, php-format
85
  msgid "Watermark was succesfully removed from 1 image."
86
  msgid_plural "Watermark was succesfully removed from %s images."
87
  msgstr[0] ""
88
  msgstr[1] ""
89
 
90
- #: ../image-watermark.php:325
91
  #, php-format
92
  msgid "Watermark was succesfully removed from %s images."
93
  msgstr ""
94
 
95
- #: ../image-watermark.php:326 ../image-watermark.php:644
96
- #: ../image-watermark.php:649
97
  msgid "Skipped files"
98
  msgstr ""
99
 
100
- #: ../image-watermark.php:327
101
  msgid "Bulk action is currently running, please wait."
102
  msgstr ""
103
 
104
- #: ../image-watermark.php:328
105
  msgid "Dismiss this notice."
106
  msgstr ""
107
 
108
- #: ../image-watermark.php:449 ../image-watermark.php:1044
109
  #: ../includes/class-settings.php:116 ../includes/class-settings.php:122
110
  msgid "Image Watermark"
111
  msgstr ""
112
 
113
- #: ../image-watermark.php:474 ../image-watermark.php:515
114
  msgid "Cheatin uh?"
115
  msgstr ""
116
 
117
- #: ../image-watermark.php:632
118
  #, php-format
119
  msgid ""
120
  "<strong>Image Watermark:</strong> Bulk watermarking is available in list "
@@ -122,29 +121,29 @@ msgid ""
122
  "List Mode</a> or <a href=\"%2$s\">Hide this notice</a>"
123
  msgstr ""
124
 
125
- #: ../image-watermark.php:642 ../image-watermark.php:647
126
  msgid "Images skipped"
127
  msgstr ""
128
 
129
- #: ../image-watermark.php:709
130
  msgid "Watermark prevented, this is your selected watermark image"
131
  msgstr ""
132
 
133
- #: ../image-watermark.php:1044 ../includes/class-settings.php:92
134
  msgid "Image backup"
135
  msgstr ""
136
 
137
- #: ../image-watermark.php:1044
138
  msgid ""
139
  "Your uploads folder is not writable so we can't create a backup of your "
140
  "image uploads. We've disabled this feature for now."
141
  msgstr ""
142
 
143
- #: ../image-watermark.php:1286
144
  msgid "Support"
145
  msgstr ""
146
 
147
- #: ../image-watermark.php:1309
148
  msgid "Settings"
149
  msgstr ""
150
 
@@ -156,38 +155,42 @@ msgstr ""
156
  msgid "PHP library"
157
  msgstr ""
158
 
159
- #: ../includes/class-settings.php:63
160
  msgid "Automatic watermarking"
161
  msgstr ""
162
 
163
- #: ../includes/class-settings.php:64
164
  msgid "Manual watermarking"
165
  msgstr ""
166
 
167
- #: ../includes/class-settings.php:65
168
  msgid "Enable watermark for"
169
  msgstr ""
170
 
171
- #: ../includes/class-settings.php:66
172
  msgid "Frontend watermarking"
173
  msgstr ""
174
 
175
- #: ../includes/class-settings.php:67
176
  msgid "Deactivation"
177
  msgstr ""
178
 
179
- #: ../includes/class-settings.php:70
180
  msgid "Watermark position"
181
  msgstr ""
182
 
183
- #: ../includes/class-settings.php:71
184
  msgid "Watermark alignment"
185
  msgstr ""
186
 
187
- #: ../includes/class-settings.php:72
188
  msgid "Watermark offset"
189
  msgstr ""
190
 
 
 
 
 
191
  #: ../includes/class-settings.php:75 ../includes/class-settings.php:76
192
  msgid "Watermark image"
193
  msgstr ""
@@ -205,7 +208,7 @@ msgid "Watermark custom size"
205
  msgstr ""
206
 
207
  #: ../includes/class-settings.php:80
208
- msgid "Scale of watermark in relation to image width"
209
  msgstr ""
210
 
211
  #: ../includes/class-settings.php:81
@@ -304,173 +307,180 @@ msgstr ""
304
  msgid "Created by"
305
  msgstr ""
306
 
307
- #: ../includes/class-settings.php:137
308
- msgid "Need image optimization?"
309
- msgstr ""
310
-
311
- #: ../includes/class-settings.php:138
312
- #, php-format
313
- msgid ""
314
- "Speed up your site with <a href=\"%s\" target=\"_blank\">ShortPixel</a>. "
315
- "Sign up as Image Watermark user and get 50&#37; extra monthly optimizations!"
316
- msgstr ""
317
-
318
- #: ../includes/class-settings.php:152
319
  msgid "Reset to defaults"
320
  msgstr ""
321
 
322
- #: ../includes/class-settings.php:255
323
  msgid "Settings saved."
324
  msgstr ""
325
 
326
- #: ../includes/class-settings.php:260
327
  msgid "Settings restored to defaults."
328
  msgstr ""
329
 
330
- #: ../includes/class-settings.php:265
331
  msgid "Watermark will not be applied when watermark image is not set."
332
  msgstr ""
333
 
334
- #: ../includes/class-settings.php:268
335
  msgid "Watermark will not be applied when no image sizes are selected."
336
  msgstr ""
337
 
338
- #: ../includes/class-settings.php:306
339
  msgid "Enable watermark for uploaded images."
340
  msgstr ""
341
 
342
- #: ../includes/class-settings.php:320
343
- msgid "Enable Apply Watermark option for images in Media Library."
 
 
 
 
344
  msgstr ""
345
 
346
- #: ../includes/class-settings.php:344
347
  msgid ""
348
- "Check image sizes on which watermark should appear.<br /><strong>IMPORTANT:</"
349
- "strong> checking full size is NOT recommended as it's the original image. "
350
- "You may need it later - for removing or changing watermark, image sizes "
351
- "regeneration or any other image manipulations. Use it only if you know what "
352
- "you are doing."
353
  msgstr ""
354
 
355
- #: ../includes/class-settings.php:361
356
  msgid "everywhere"
357
  msgstr ""
358
 
359
- #: ../includes/class-settings.php:362
360
  msgid "on selected post types only"
361
  msgstr ""
362
 
363
- #: ../includes/class-settings.php:376
364
  msgid ""
365
  "Check custom post types on which watermark should be applied to uploaded "
366
  "images."
367
  msgstr ""
368
 
369
- #: ../includes/class-settings.php:390
370
  msgid ""
371
  "Enable frontend image uploading. (uploading script is not included, but you "
372
  "may use a plugin or custom code)."
373
  msgstr ""
374
 
375
- #: ../includes/class-settings.php:392
376
  msgid ""
377
  "<br /><strong>Notice:</strong> This functionality works only if uploaded "
378
  "images are processed using WordPress native upload methods."
379
  msgstr ""
380
 
381
- #: ../includes/class-settings.php:405
382
  msgid "Delete all database settings on plugin deactivation."
383
  msgstr ""
384
 
385
- #: ../includes/class-settings.php:438
386
- msgid "Choose the position of watermark image."
 
 
 
 
 
 
 
 
 
 
 
 
387
  msgstr ""
388
 
389
- #: ../includes/class-settings.php:451 ../includes/class-settings.php:548
390
  msgid "x:"
391
  msgstr ""
392
 
393
- #: ../includes/class-settings.php:453 ../includes/class-settings.php:550
394
  msgid "y:"
395
  msgstr ""
396
 
397
- #: ../includes/class-settings.php:473
 
 
 
 
398
  msgid "Select image"
399
  msgstr ""
400
 
401
- #: ../includes/class-settings.php:474
402
  msgid "Remove image"
403
  msgstr ""
404
 
405
- #: ../includes/class-settings.php:475
406
  msgid "You have to save changes after the selection or removal of the image."
407
  msgstr ""
408
 
409
- #: ../includes/class-settings.php:528
410
  msgid "original"
411
  msgstr ""
412
 
413
- #: ../includes/class-settings.php:530
414
  msgid "custom"
415
  msgstr ""
416
 
417
- #: ../includes/class-settings.php:532
418
  msgid "scaled"
419
  msgstr ""
420
 
421
- #: ../includes/class-settings.php:535
422
  msgid "Select method of aplying watermark size."
423
  msgstr ""
424
 
425
- #: ../includes/class-settings.php:552
426
  msgid "Those dimensions will be used if \"custom\" method is selected above."
427
  msgstr ""
428
 
429
- #: ../includes/class-settings.php:571
430
  msgid ""
431
- "This value will be used if \"scaled\" method if selected above. <br />Enter "
432
- "a number ranging from 0 to 100. 100 makes width of watermark image equal to "
433
- "width of the image it is applied to."
434
  msgstr ""
435
 
436
- #: ../includes/class-settings.php:590
437
  msgid ""
438
  "Enter a number ranging from 0 to 100. 0 makes watermark image completely "
439
  "transparent, 100 shows it as is."
440
  msgstr ""
441
 
442
- #: ../includes/class-settings.php:609 ../includes/class-settings.php:703
443
  msgid "Set output image quality."
444
  msgstr ""
445
 
446
- #: ../includes/class-settings.php:622
447
  msgid "baseline"
448
  msgstr ""
449
 
450
- #: ../includes/class-settings.php:624
451
  msgid "progressive"
452
  msgstr ""
453
 
454
- #: ../includes/class-settings.php:628
455
  msgid "Select baseline or progressive image format."
456
  msgstr ""
457
 
458
- #: ../includes/class-settings.php:641
459
  msgid "Disable right mouse click on images"
460
  msgstr ""
461
 
462
- #: ../includes/class-settings.php:655
463
  msgid "Prevent drag and drop"
464
  msgstr ""
465
 
466
- #: ../includes/class-settings.php:669
467
  msgid "Enable image protection for logged-in users also"
468
  msgstr ""
469
 
470
- #: ../includes/class-settings.php:683
471
  msgid "Backup the full size image."
472
  msgstr ""
473
 
474
- #: ../includes/class-settings.php:726
475
  msgid "Toggle panel"
476
  msgstr ""
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: WordPress Watermark\n"
5
+ "POT-Creation-Date: 2017-12-08 10:49+0100\n"
6
  "PO-Revision-Date: 2015-05-15 19:55+0100\n"
7
  "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
8
  "Language-Team: dFactory <info@dfactory.pl>\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Generator: Poedit 2.0.5\n"
14
  "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;esc_attr__;esc_attr_e;"
15
  "_n:1,2\n"
16
  "X-Poedit-Basepath: .\n"
18
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
19
  "X-Poedit-SearchPath-0: ..\n"
20
 
21
+ #: ../image-watermark.php:251 ../image-watermark.php:455
22
  msgid "Apply watermark"
23
  msgstr ""
24
 
25
+ #: ../image-watermark.php:254 ../image-watermark.php:455
26
  msgid "Remove watermark"
27
  msgstr ""
28
 
29
+ #: ../image-watermark.php:288
30
  msgid "Select watermark"
31
  msgstr ""
32
 
33
+ #: ../image-watermark.php:289 ../includes/class-settings.php:525
34
  msgid "Original size"
35
  msgstr ""
36
 
37
+ #: ../image-watermark.php:290 ../includes/class-settings.php:521
38
  msgid "Watermak has not been selected yet."
39
  msgstr ""
40
 
41
+ #: ../image-watermark.php:291
42
  msgid "This image is not supported as watermark. Use JPEG, PNG or GIF."
43
  msgstr ""
44
 
45
+ #: ../image-watermark.php:292 ../includes/class-settings.php:525
46
+ #: ../includes/class-settings.php:559 ../includes/class-settings.php:561
 
47
  msgid "px"
48
  msgstr ""
49
 
50
+ #: ../image-watermark.php:294
51
  msgid "Add watermark"
52
  msgstr ""
53
 
54
+ #: ../image-watermark.php:303
55
  msgid "Are you sure you want to reset settings to defaults?"
56
  msgstr ""
57
 
58
+ #: ../image-watermark.php:326 ../image-watermark.php:645
59
  msgid ""
60
  "Watermark could not be applied to selected files or no valid images (JPEG, "
61
  "PNG) were selected."
62
  msgstr ""
63
 
64
+ #: ../image-watermark.php:327 ../image-watermark.php:647
65
  #, php-format
66
  msgid "Watermark was succesfully applied to 1 image."
67
  msgid_plural "Watermark was succesfully applied to %s images."
68
  msgstr[0] ""
69
  msgstr[1] ""
70
 
71
+ #: ../image-watermark.php:328
72
  #, php-format
73
  msgid "Watermark was succesfully applied to %s images."
74
  msgstr ""
75
 
76
+ #: ../image-watermark.php:329 ../image-watermark.php:650
77
  msgid ""
78
  "Watermark could not be removed from selected files or no valid images (JPEG, "
79
  "PNG) were selected."
80
  msgstr ""
81
 
82
+ #: ../image-watermark.php:330 ../image-watermark.php:652
83
  #, php-format
84
  msgid "Watermark was succesfully removed from 1 image."
85
  msgid_plural "Watermark was succesfully removed from %s images."
86
  msgstr[0] ""
87
  msgstr[1] ""
88
 
89
+ #: ../image-watermark.php:331
90
  #, php-format
91
  msgid "Watermark was succesfully removed from %s images."
92
  msgstr ""
93
 
94
+ #: ../image-watermark.php:332 ../image-watermark.php:647
95
+ #: ../image-watermark.php:652
96
  msgid "Skipped files"
97
  msgstr ""
98
 
99
+ #: ../image-watermark.php:333
100
  msgid "Bulk action is currently running, please wait."
101
  msgstr ""
102
 
103
+ #: ../image-watermark.php:334
104
  msgid "Dismiss this notice."
105
  msgstr ""
106
 
107
+ #: ../image-watermark.php:454 ../image-watermark.php:1165
108
  #: ../includes/class-settings.php:116 ../includes/class-settings.php:122
109
  msgid "Image Watermark"
110
  msgstr ""
111
 
112
+ #: ../image-watermark.php:478 ../image-watermark.php:518
113
  msgid "Cheatin uh?"
114
  msgstr ""
115
 
116
+ #: ../image-watermark.php:635
117
  #, php-format
118
  msgid ""
119
  "<strong>Image Watermark:</strong> Bulk watermarking is available in list "
121
  "List Mode</a> or <a href=\"%2$s\">Hide this notice</a>"
122
  msgstr ""
123
 
124
+ #: ../image-watermark.php:645 ../image-watermark.php:650
125
  msgid "Images skipped"
126
  msgstr ""
127
 
128
+ #: ../image-watermark.php:711
129
  msgid "Watermark prevented, this is your selected watermark image"
130
  msgstr ""
131
 
132
+ #: ../image-watermark.php:1165 ../includes/class-settings.php:92
133
  msgid "Image backup"
134
  msgstr ""
135
 
136
+ #: ../image-watermark.php:1165
137
  msgid ""
138
  "Your uploads folder is not writable so we can't create a backup of your "
139
  "image uploads. We've disabled this feature for now."
140
  msgstr ""
141
 
142
+ #: ../image-watermark.php:1412
143
  msgid "Support"
144
  msgstr ""
145
 
146
+ #: ../image-watermark.php:1435
147
  msgid "Settings"
148
  msgstr ""
149
 
155
  msgid "PHP library"
156
  msgstr ""
157
 
158
+ #: ../includes/class-settings.php:62
159
  msgid "Automatic watermarking"
160
  msgstr ""
161
 
162
+ #: ../includes/class-settings.php:63
163
  msgid "Manual watermarking"
164
  msgstr ""
165
 
166
+ #: ../includes/class-settings.php:64
167
  msgid "Enable watermark for"
168
  msgstr ""
169
 
170
+ #: ../includes/class-settings.php:65
171
  msgid "Frontend watermarking"
172
  msgstr ""
173
 
174
+ #: ../includes/class-settings.php:66
175
  msgid "Deactivation"
176
  msgstr ""
177
 
178
+ #: ../includes/class-settings.php:69
179
  msgid "Watermark position"
180
  msgstr ""
181
 
182
+ #: ../includes/class-settings.php:70
183
  msgid "Watermark alignment"
184
  msgstr ""
185
 
186
+ #: ../includes/class-settings.php:71
187
  msgid "Watermark offset"
188
  msgstr ""
189
 
190
+ #: ../includes/class-settings.php:72
191
+ msgid "Offset unit"
192
+ msgstr ""
193
+
194
  #: ../includes/class-settings.php:75 ../includes/class-settings.php:76
195
  msgid "Watermark image"
196
  msgstr ""
208
  msgstr ""
209
 
210
  #: ../includes/class-settings.php:80
211
+ msgid "Watermark scale"
212
  msgstr ""
213
 
214
  #: ../includes/class-settings.php:81
307
  msgid "Created by"
308
  msgstr ""
309
 
310
+ #: ../includes/class-settings.php:148
 
 
 
 
 
 
 
 
 
 
 
311
  msgid "Reset to defaults"
312
  msgstr ""
313
 
314
+ #: ../includes/class-settings.php:252
315
  msgid "Settings saved."
316
  msgstr ""
317
 
318
+ #: ../includes/class-settings.php:257
319
  msgid "Settings restored to defaults."
320
  msgstr ""
321
 
322
+ #: ../includes/class-settings.php:262
323
  msgid "Watermark will not be applied when watermark image is not set."
324
  msgstr ""
325
 
326
+ #: ../includes/class-settings.php:265
327
  msgid "Watermark will not be applied when no image sizes are selected."
328
  msgstr ""
329
 
330
+ #: ../includes/class-settings.php:303
331
  msgid "Enable watermark for uploaded images."
332
  msgstr ""
333
 
334
+ #: ../includes/class-settings.php:317
335
+ msgid "Enable Apply Watermark option for Media Library images."
336
+ msgstr ""
337
+
338
+ #: ../includes/class-settings.php:341
339
+ msgid "Check the image sizes watermark will be applied to."
340
  msgstr ""
341
 
342
+ #: ../includes/class-settings.php:342
343
  msgid ""
344
+ "<strong>IMPORTANT:</strong> checking full size is NOT recommended as it's "
345
+ "the original image. You may need it later - for removing or changing "
346
+ "watermark, image sizes regeneration or any other image manipulations. Use it "
347
+ "only if you know what you are doing."
 
348
  msgstr ""
349
 
350
+ #: ../includes/class-settings.php:359
351
  msgid "everywhere"
352
  msgstr ""
353
 
354
+ #: ../includes/class-settings.php:360
355
  msgid "on selected post types only"
356
  msgstr ""
357
 
358
+ #: ../includes/class-settings.php:374
359
  msgid ""
360
  "Check custom post types on which watermark should be applied to uploaded "
361
  "images."
362
  msgstr ""
363
 
364
+ #: ../includes/class-settings.php:388
365
  msgid ""
366
  "Enable frontend image uploading. (uploading script is not included, but you "
367
  "may use a plugin or custom code)."
368
  msgstr ""
369
 
370
+ #: ../includes/class-settings.php:390
371
  msgid ""
372
  "<br /><strong>Notice:</strong> This functionality works only if uploaded "
373
  "images are processed using WordPress native upload methods."
374
  msgstr ""
375
 
376
+ #: ../includes/class-settings.php:403
377
  msgid "Delete all database settings on plugin deactivation."
378
  msgstr ""
379
 
380
+ #: ../includes/class-settings.php:436
381
+ msgid "Select the watermark alignment."
382
+ msgstr ""
383
+
384
+ #: ../includes/class-settings.php:449
385
+ msgid "pixels"
386
+ msgstr ""
387
+
388
+ #: ../includes/class-settings.php:450
389
+ msgid "percentages"
390
+ msgstr ""
391
+
392
+ #: ../includes/class-settings.php:451
393
+ msgid "Select the watermark offset unit."
394
  msgstr ""
395
 
396
+ #: ../includes/class-settings.php:464 ../includes/class-settings.php:559
397
  msgid "x:"
398
  msgstr ""
399
 
400
+ #: ../includes/class-settings.php:466 ../includes/class-settings.php:561
401
  msgid "y:"
402
  msgstr ""
403
 
404
+ #: ../includes/class-settings.php:467
405
+ msgid "Enter watermark offset value."
406
+ msgstr ""
407
+
408
+ #: ../includes/class-settings.php:487
409
  msgid "Select image"
410
  msgstr ""
411
 
412
+ #: ../includes/class-settings.php:488
413
  msgid "Remove image"
414
  msgstr ""
415
 
416
+ #: ../includes/class-settings.php:489
417
  msgid "You have to save changes after the selection or removal of the image."
418
  msgstr ""
419
 
420
+ #: ../includes/class-settings.php:542
421
  msgid "original"
422
  msgstr ""
423
 
424
+ #: ../includes/class-settings.php:543
425
  msgid "custom"
426
  msgstr ""
427
 
428
+ #: ../includes/class-settings.php:544
429
  msgid "scaled"
430
  msgstr ""
431
 
432
+ #: ../includes/class-settings.php:546
433
  msgid "Select method of aplying watermark size."
434
  msgstr ""
435
 
436
+ #: ../includes/class-settings.php:563
437
  msgid "Those dimensions will be used if \"custom\" method is selected above."
438
  msgstr ""
439
 
440
+ #: ../includes/class-settings.php:582
441
  msgid ""
442
+ "Enter a number ranging from 0 to 100. 100 makes width of watermark image "
443
+ "equal to width of the image it is applied to."
 
444
  msgstr ""
445
 
446
+ #: ../includes/class-settings.php:601
447
  msgid ""
448
  "Enter a number ranging from 0 to 100. 0 makes watermark image completely "
449
  "transparent, 100 shows it as is."
450
  msgstr ""
451
 
452
+ #: ../includes/class-settings.php:620 ../includes/class-settings.php:712
453
  msgid "Set output image quality."
454
  msgstr ""
455
 
456
+ #: ../includes/class-settings.php:633
457
  msgid "baseline"
458
  msgstr ""
459
 
460
+ #: ../includes/class-settings.php:634
461
  msgid "progressive"
462
  msgstr ""
463
 
464
+ #: ../includes/class-settings.php:637
465
  msgid "Select baseline or progressive image format."
466
  msgstr ""
467
 
468
+ #: ../includes/class-settings.php:650
469
  msgid "Disable right mouse click on images"
470
  msgstr ""
471
 
472
+ #: ../includes/class-settings.php:664
473
  msgid "Prevent drag and drop"
474
  msgstr ""
475
 
476
+ #: ../includes/class-settings.php:678
477
  msgid "Enable image protection for logged-in users also"
478
  msgstr ""
479
 
480
+ #: ../includes/class-settings.php:692
481
  msgid "Backup the full size image."
482
  msgstr ""
483
 
484
+ #: ../includes/class-settings.php:735
485
  msgid "Toggle panel"
486
  msgstr ""
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.7
7
- Stable tag: 1.6.1
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -54,6 +54,10 @@ No questions yet.
54
 
55
  == Changelog ==
56
 
 
 
 
 
57
  = 1.6.1 =
58
  * Fix: Minor bug with AJAX requests, thanks to [JoryHogeveen](https://github.com/JoryHogeveen)
59
  * Fix: Prevent watermarking the watermark image, thanks to [JoryHogeveen](https://github.com/JoryHogeveen)
@@ -167,5 +171,5 @@ Initial release
167
 
168
  == Upgrade Notice ==
169
 
170
- = 1.6.1 =
171
- * Fix: Minor bug with AJAX requests * Fix: Prevent watermarking the watermark image * Tweak: Code cleanup
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
 
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
60
+
61
  = 1.6.1 =
62
  * Fix: Minor bug with AJAX requests, thanks to [JoryHogeveen](https://github.com/JoryHogeveen)
63
  * Fix: Prevent watermarking the watermark image, thanks to [JoryHogeveen](https://github.com/JoryHogeveen)
171
 
172
  == Upgrade Notice ==
173
 
174
+ = 1.6.2 =
175
+ * New: Option to select watermark offset unit - pixels or percentages