Easy Watermark - Version 0.6.0

Version Description

  • Added: backup option for watermarked images - allows to restore original image
  • Added: button to restore all original images on the plugins page
  • Changed method of watermarking all images
    • it now uses ajax and watermarks 10 images at once so it needs less time and memory per request
Download this release

Release Info

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

Code changes from version 0.5.2 to 0.6.0

classes/class-ew-plugin-core.php CHANGED
@@ -23,7 +23,7 @@ class EW_Plugin_Core extends EW_Pluggable
23
/**
24
* @var string plugin version
25
*/
26
- protected static $version = '0.5.2';
27
28
/**
29
* @var string plugin class name
23
/**
24
* @var string plugin version
25
*/
26
+ protected static $version = '0.6.0';
27
28
/**
29
* @var string plugin class name
classes/class-ew-plugin.php CHANGED
@@ -52,7 +52,12 @@ class EW_Plugin extends EW_Plugin_Core
52
/**
53
* @var boolean
54
*/
55
- private $isBulkAction = false;
56
57
/**
58
* Loads textdomain for translations,
@@ -71,6 +76,7 @@ class EW_Plugin extends EW_Plugin_Core
71
// load admin interface
72
if(is_admin()){
73
$this->add_action('admin_menu', 'add_media_page')
74
->add_filter('media_row_actions', 'add_media_row_action', 10, 3)
75
// ->add_filter('attachment_fields_to_edit', 'add_attachment_field', 10, 2)
76
->add_action('admin_notices')
@@ -79,7 +85,10 @@ class EW_Plugin extends EW_Plugin_Core
79
->add_action('admin_print_scripts', 'easy_watermark_style')
80
->add_action('manage_media_columns', 'add_media_column')
81
->add_action('manage_media_custom_column', null, 10, 2)
82
- ->add_action('add_meta_boxes');
83
}
84
85
$this->test_GD();
@@ -125,8 +134,10 @@ class EW_Plugin extends EW_Plugin_Core
125
*/
126
public function plugin_init(){
127
new EW_Settings($this);
128
129
- if(is_admin() && isset($_GET['page'])){
130
if($_GET['page'] == 'easy-watermark-settings' && isset($_GET['tp']) && $_GET['tp'] == 1){
131
$this->print_text_preview();
132
}
@@ -135,6 +146,8 @@ class EW_Plugin extends EW_Plugin_Core
135
$this->add_watermark();
136
if(wp_verify_nonce($_GET['_wpnonce'], 'ew_mark'))
137
$this->mark_image();
138
}
139
}
140
}
@@ -186,7 +199,7 @@ class EW_Plugin extends EW_Plugin_Core
186
}
187
188
/**
189
- * Performs watermarking the single image
190
*
191
* @return void
192
*/
@@ -200,7 +213,7 @@ class EW_Plugin extends EW_Plugin_Core
200
wp_die( __( 'Cheatin’ uh?' ) );
201
202
$url = false;
203
- if($this->watermark_single($post)){
204
switch($_GET['r']){
205
case 'library':
206
$url = admin_url('upload.php?watermarked=1');
@@ -360,18 +373,12 @@ EOD;
360
$result = true;
361
$this->isBulkAction = true;
362
foreach($_REQUEST['media'] as $entry){
363
- if(!$this->watermark_single((int) $entry) && $this->error != 99)
364
$result = false;
365
}
366
367
if(isset($_GET['_wp_http_referer'])){
368
$referer = $_GET['_wp_http_referer'];
369
- // if(strpos($referer, '?'))
370
- // $referer .= '&';
371
- // else
372
- // $referer .= '?';
373
-
374
- // $referer .= $result ? 'watermarked=1' : 'ew_error=2';
375
376
$args = $result ? array('watermarked' => '1') : array('ew_error' => $this->error);
377
$referer = add_query_arg($args, remove_query_arg(array('ew_error', 'watermarked'), $referer));
@@ -383,7 +390,7 @@ EOD;
383
384
/**
385
* Watermark image after it was uploaded.
386
- * In fact this method only mark that there is an image to watermark,
387
* it's realy watermarked in wp_generate_attachment_metadata filter.
388
* See wp_generate_attachment_metadata() method below.
389
*
@@ -411,11 +418,11 @@ EOD;
411
* @return array
412
*/
413
public function wp_generate_attachment_metadata($metadata, $id){
414
- if($this->settings['general']['auto_add']
415
&& ($this->settings['general']['auto_add_perm'] == '1' || $this->checkRolePermission())
416
&& $this->checkPostType()){
417
418
- $this->watermark_single($id, true, $metadata);
419
420
$this->watermark_uploaded = false;
421
$this->uploaded_id = null;
@@ -425,7 +432,7 @@ EOD;
425
}
426
427
/**
428
- * Performs the action of a single image watermarking
429
*
430
* @uses self::create_watermark
431
* @param integer image id
@@ -433,7 +440,7 @@ EOD;
433
* @param array image meta
434
* @return boolean
435
*/
436
- private function watermark_single($post, $checkMime = false, $meta = array()){
437
if($this->isGDEnabled()) :
438
439
if($this->settings['image']['watermark_path'] != '' || $this->settings['text']['text'] != null){
@@ -458,6 +465,21 @@ EOD;
458
endif;
459
}
460
461
/**
462
* Performs the action of watermarking all images from library
463
*
@@ -467,14 +489,24 @@ EOD;
467
private function watermark_all(){
468
if($this->isGDEnabled()) :
469
470
global $wpdb;
471
472
- $images = $wpdb->get_results("
473
SELECT ID, post_mime_type, post_author, post_title
474
- FROM $wpdb->posts
475
WHERE post_type = 'attachment'
476
- AND post_mime_type LIKE 'image/%'
477
- ");
478
479
$output = '';
480
$skipped = 0;
@@ -506,6 +538,12 @@ EOD;
506
507
$output = '<p>'.$output.'</p>';
508
509
return $output;
510
511
endif;
@@ -514,15 +552,14 @@ EOD;
514
/**
515
* Applies the watermark to the defined image sizes
516
*
517
- * @use self::watermark_image()
518
* @param object wp post
519
* @return boolean
520
*/
521
public function create_watermark($post, $meta = array()){
522
523
if(empty($meta)){
524
- $meta = get_post_meta($post->ID, '_wp_attachment_metadata');
525
- $meta = $meta[0];
526
}
527
528
$filepath = get_attached_file($post->ID);
@@ -532,6 +569,13 @@ EOD;
532
533
$this->currentImage = $post;
534
535
if($this->isBulkAction){
536
// Refresh watermark text for each image
537
$this->getEasyWatermark()->setText($this->parseText($this->settings['text']['text']));
@@ -549,11 +593,13 @@ EOD;
549
foreach($sizes as $size => $img){
550
if(in_array($size, $allowedSizes)){
551
$imgFile = str_replace($filebasename, wp_basename($img['file']), $filepath);
552
- if(!$this->watermark_image($imgFile, $img['mime-type']))
553
$return = false;
554
}
555
}
556
if($return){
557
update_post_meta($post->ID, '_ew_watermarked', '1');
558
}
559
@@ -566,13 +612,54 @@ EOD;
566
}
567
568
/**
569
- * Applies the watermark to the given image
570
*
571
* @param string path to image file
572
* @param string image mime type
573
* @return boolean
574
*/
575
- private function watermark_image($imageFile, $imageType){
576
if($this->isGDEnabled()){
577
578
$ew = $this->getEasyWatermark();
@@ -634,6 +721,54 @@ EOD;
634
* @return void
635
*/
636
public function easy_watermark(){
637
include EWVIEWS . EWDS . 'easy-watermark-page.php';
638
}
639
@@ -668,6 +803,109 @@ echo '<style type="text/css" media="screen">
668
exit;
669
}
670
671
/**
672
* Adds Easy Watermark column in media library
673
*
@@ -711,6 +949,8 @@ echo '<style type="text/css" media="screen">
711
private function display_column_and_metabox($post_id, $page = 'library'){
712
if($post_id != $this->settings['image']['watermark_id']){
713
$watermarked = get_post_meta($post_id, '_ew_watermarked', true);
714
$status = $watermarked == '1' ? __('watermarked', 'easy-watermark') : __('not watermarked', 'easy-watermark');
715
echo __('Status', 'easy-watermark') . ': <strong>' . $status . '</strong><br/>';
716
@@ -728,7 +968,13 @@ echo '<style type="text/css" media="screen">
728
$class = null;
729
}
730
731
- echo '<a href="'.wp_nonce_url(admin_url('upload.php?page=easy-watermark&attachment_id='.$post_id.'&r='.$page.'&mark='.$mark), 'ew_mark').'">' . $link_text . '</a><br/><br/><strong><a href="' . wp_nonce_url(admin_url('upload.php?page=easy-watermark&attachment_id='.$post_id.'&r='.$page), 'ew_add_watermark') . '"'.$class.'>'.__('Add Watermark', 'easy-watermark').'</a></strong>';
732
}
733
}
734
52
/**
53
* @var boolean
54
*/
55
+ private $isBulkAction = false;
56
+
57
+ /**
58
+ * @var boolean flag to turn off auto watermark function when restoring files
59
+ */
60
+ private $restoring = false;
61
62
/**
63
* Loads textdomain for translations,
76
// load admin interface
77
if(is_admin()){
78
$this->add_action('admin_menu', 'add_media_page')
79
+ ->add_action('admin_init')
80
->add_filter('media_row_actions', 'add_media_row_action', 10, 3)
81
// ->add_filter('attachment_fields_to_edit', 'add_attachment_field', 10, 2)
82
->add_action('admin_notices')
85
->add_action('admin_print_scripts', 'easy_watermark_style')
86
->add_action('manage_media_columns', 'add_media_column')
87
->add_action('manage_media_custom_column', null, 10, 2)
88
+ ->add_action('add_meta_boxes')
89
+ ->add_action('delete_attachment', 'clean_backup')
90
+ ->add_action('wp_ajax_watermark_all')
91
+ ->add_action('wp_ajax_restore_all');
92
}
93
94
$this->test_GD();
134
*/
135
public function plugin_init(){
136
new EW_Settings($this);
137
+ }
138
139
+ public function admin_init(){
140
+ if(isset($_GET['page'])){
141
if($_GET['page'] == 'easy-watermark-settings' && isset($_GET['tp']) && $_GET['tp'] == 1){
142
$this->print_text_preview();
143
}
146
$this->add_watermark();
147
if(wp_verify_nonce($_GET['_wpnonce'], 'ew_mark'))
148
$this->mark_image();
149
+ if(wp_verify_nonce($_GET['_wpnonce'], 'ew_restore'))
150
+ $this->restore_single();
151
}
152
}
153
}
199
}
200
201
/**
202
+ * Performs watermarking the single attachment
203
*
204
* @return void
205
*/
213
wp_die( __( 'Cheatin&#8217; uh?' ) );
214
215
$url = false;
216
+ if($this->watermark_attachment($post)){
217
switch($_GET['r']){
218
case 'library':
219
$url = admin_url('upload.php?watermarked=1');
373
$result = true;
374
$this->isBulkAction = true;
375
foreach($_REQUEST['media'] as $entry){
376
+ if(!$this->watermark_attachment((int) $entry) && $this->error != 99)
377
$result = false;
378
}
379
380
if(isset($_GET['_wp_http_referer'])){
381
$referer = $_GET['_wp_http_referer'];
382
383
$args = $result ? array('watermarked' => '1') : array('ew_error' => $this->error);
384
$referer = add_query_arg($args, remove_query_arg(array('ew_error', 'watermarked'), $referer));
390
391
/**
392
* Watermark image after it was uploaded.
393
+ * In fact this method only marks that there is an image to watermark,
394
* it's realy watermarked in wp_generate_attachment_metadata filter.
395
* See wp_generate_attachment_metadata() method below.
396
*
418
* @return array
419
*/
420
public function wp_generate_attachment_metadata($metadata, $id){
421
+ if($this->settings['general']['auto_add'] && !$this->restoring
422
&& ($this->settings['general']['auto_add_perm'] == '1' || $this->checkRolePermission())
423
&& $this->checkPostType()){
424
425
+ $this->watermark_attachment($id, true, $metadata);
426
427
$this->watermark_uploaded = false;
428
$this->uploaded_id = null;
432
}
433
434
/**
435
+ * Performs the action of a single attachment watermarking
436
*
437
* @uses self::create_watermark
438
* @param integer image id
440
* @param array image meta
441
* @return boolean
442
*/
443
+ private function watermark_attachment($post, $checkMime = false, $meta = array()){
444
if($this->isGDEnabled()) :
445
446
if($this->settings['image']['watermark_path'] != '' || $this->settings['text']['text'] != null){
465
endif;
466
}
467
468
+ public function wp_ajax_watermark_all(){
469
+ check_ajax_referer('watermark_all_confirmed', '_ewnonce');
470
+
471
+ $msg = $this->watermark_all();
472
+
473
+ $output = array(
474
+ 'progress' => get_option('ew-bulk-counter'),
475
+ 'message' => $msg
476
+ );
477
+
478
+ echo json_encode($output);
479
+
480
+ exit;
481
+ }
482
+
483
/**
484
* Performs the action of watermarking all images from library
485
*
489
private function watermark_all(){
490
if($this->isGDEnabled()) :
491
492
+ $page = get_option('ew-bulk-page', 0);
493
+ $count = get_option('ew-bulk-counter', 0);
494
+ $total = get_option('ew-bulk-total', 0);
495
+
496
+ $limit = 10;
497
+ $offset = $page * $limit;
498
+
499
global $wpdb;
500
501
+ $images = $wpdb->get_results($wpdb->prepare("
502
SELECT ID, post_mime_type, post_author, post_title
503
+ FROM {$wpdb->posts}
504
WHERE post_type = 'attachment'
505
+ AND post_mime_type LIKE %s
506
+ ORDER BY ID ASC LIMIT %d OFFSET %d",
507
+
508
+ 'image/%', $limit, $offset
509
+ ));
510
511
$output = '';
512
$skipped = 0;
538
539
$output = '<p>'.$output.'</p>';
540
541
+ $count += $limit;
542
+ if($count > $total) $count = $total;
543
+
544
+ update_option('ew-bulk-page', $page + 1);
545
+ update_option('ew-bulk-counter', $count);
546
+
547
return $output;
548
549
endif;
552
/**
553
* Applies the watermark to the defined image sizes
554
*
555
+ * @use self::watermark_single_image()
556
* @param object wp post
557
* @return boolean
558
*/
559
public function create_watermark($post, $meta = array()){
560
561
if(empty($meta)){
562
+ $meta = get_post_meta($post->ID, '_wp_attachment_metadata', true);
563
}
564
565
$filepath = get_attached_file($post->ID);
569
570
$this->currentImage = $post;
571
572
+ if($this->settings['general']['backup']){
573
+ $backup_file = $this->backup_attachment($filepath, $filebasename);
574
+ if(is_string($backup_file)){
575
+ update_post_meta($post->ID, '_ew_backup_file', $backup_file);
576
+ }
577
+ }
578
+
579
if($this->isBulkAction){
580
// Refresh watermark text for each image
581
$this->getEasyWatermark()->setText($this->parseText($this->settings['text']['text']));
593
foreach($sizes as $size => $img){
594
if(in_array($size, $allowedSizes)){
595
$imgFile = str_replace($filebasename, wp_basename($img['file']), $filepath);
596
+ if(!$this->watermark_single_image($imgFile, $img['mime-type']))
597
$return = false;
598
}
599
}
600
+
601
if($return){
602
+ // mark attachment as watermarked
603
update_post_meta($post->ID, '_ew_watermarked', '1');
604
}
605
612
}
613
614
/**
615
+ * Saves copy of the original image to allow to restore it
616
+ *
617
+ * @param string file path
618
+ * @return void
619
+ */
620
+ private function backup_attachment($filepath, $filename){
621
+ $upload_dir = wp_upload_dir();
622
+ $uploads = $upload_dir['basedir'];
623
+
624
+ $subdir = str_replace(array($uploads, $filename), '', $filepath);
625
+
626
+ $backup_dir = WP_CONTENT_DIR . EWDS . 'ew_backup' . $subdir;
627
+ $new_file = $backup_dir . $filename;
628
+
629
+ if(!file_exists($new_file)){
630
+
631
+ if(!is_dir($backup_dir)){
632
+ mkdir($backup_dir, 0755, true);
633
+ }
634
+
635
+ $result = copy($filepath, $new_file);
636
+
637
+ if($result){
638
+ return $new_file;
639
+ }
640
+
641
+ return false;
642
+ }
643
+
644
+ return true;
645
+ }
646
+
647
+ public function clean_backup($post_id){
648
+ $file = get_post_meta($post_id, '_ew_backup_file', true);
649
+
650
+ if(file_exists($file)){
651
+ unlink($file);
652
+ }
653
+ }
654
+
655
+ /**
656
+ * Applies the watermark to the given image file
657
*
658
* @param string path to image file
659
* @param string image mime type
660
* @return boolean
661
*/
662
+ private function watermark_single_image($imageFile, $imageType){
663
if($this->isGDEnabled()){
664
665
$ew = $this->getEasyWatermark();
721
* @return void
722
*/
723
public function easy_watermark(){
724
+ if(isset($_GET['_wpnonce'])){
725
+ global $wpdb, $wp_scripts;
726
+
727
+ wp_enqueue_style('ew-tools', plugins_url() . '/easy-watermark/css/tools.css');
728
+ wp_register_script('ewajax', plugin_dir_url(EWBASE . '/index.php') . 'js/ewajax.js', array('jquery', 'jquery-ui-progressbar'));
729
+
730
+ wp_enqueue_style('jquery-ui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/' . $wp_scripts->registered['jquery-ui-core']->ver . '/themes/smoothness/jquery-ui.css');
731
+
732
+ update_option('ew-bulk-page', 0);
733
+ update_option('ew-bulk-counter', 0);
734
+
735
+ if(isset($_GET['watermark_all']) && wp_verify_nonce($_GET['_wpnonce'], 'watermark_all')){
736
+ $count = $wpdb->get_var("SELECT count(*) FROM $wpdb->posts
737
+ WHERE post_type = 'attachment'
738
+ AND post_mime_type LIKE 'image/%'");
739
+
740
+ wp_localize_script('ewajax', 'ewData', array(
741
+ 'nonce' => wp_create_nonce('watermark_all_confirmed'),
742
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
743
+ 'total_items' => $count,
744
+ 'complete' => __('Complete!', 'easy-watermark')
745
+ ));
746
+
747
+ wp_enqueue_script('watermark-all', plugin_dir_url(EWBASE . '/index.php') . 'js/watermark-all.js', array('ewajax'));
748
+
749
+ update_option('ew-bulk-total', $count);
750
+
751
+ $current_tool = 'watermark_all';
752
+ }
753
+ elseif(isset($_GET['restore_all']) && wp_verify_nonce($_GET['_wpnonce'], 'restore_all')){
754
+ $count = $wpdb->get_var("SELECT count(*) FROM $wpdb->postmeta
755
+ WHERE meta_key = '_ew_backup_file'");
756
+
757
+ wp_localize_script('ewajax', 'ewData', array(
758
+ 'nonce' => wp_create_nonce('restore_all_confirmed'),
759
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
760
+ 'total_items' => $count,
761
+ 'complete' => __('Complete!', 'easy-watermark')
762
+ ));
763
+
764
+ wp_enqueue_script('restore-all', plugin_dir_url(EWBASE . '/index.php') . 'js/restore-all.js', array('ewajax'));
765
+
766
+ update_option('ew-bulk-total', $count);
767
+
768
+ $current_tool = 'restore_all';
769
+ }
770
+ }
771
+
772
include EWVIEWS . EWDS . 'easy-watermark-page.php';
773
}
774
803
exit;
804
}
805
806
+ /**
807
+ * Restores original image
808
+ *
809
+ * @return void
810
+ */
811
+ private function restore_single(){
812
+ $id = (int) $_GET['attachment_id'];
813
+ $page = $_GET['r'];
814
+
815
+ $this->restore_image($id);
816
+
817
+ $url = $page == 'library' ? admin_url('upload.php?restored=1') : admin_url('post.php?post='.$id.'&action=edit&restored=1');
818
+
819
+ wp_redirect($url);
820
+ exit;
821
+ }
822
+
823
+ /**
824
+ * Restores original images for bulk action ajax request
825
+ *
826
+ * @return void
827
+ */
828
+ public function wp_ajax_restore_all(){
829
+ check_ajax_referer('restore_all_confirmed', '_ewnonce');
830
+
831
+ global $wpdb;
832
+
833
+ $page = get_option('ew-bulk-page', 0);
834
+ $count = get_option('ew-bulk-counter', 0);
835
+ $total = get_option('ew-bulk-total', 0);
836
+
837
+ $limit = 10;
838
+ $offset = $page * $limit;
839
+
840
+ $items = $wpdb->get_results($wpdb->prepare("
841
+ SELECT * from $wpdb->postmeta where meta_key = '_ew_backup_file'
842
+ order by meta_id ASC LIMIT %d
843
+ ", $limit, $offset));
844
+
845
+ $output = array();
846
+ foreach($items as $item){
847
+ $this->restore_image($item->post_id);
848
+ $output[] = sprintf(__('Image succesfully restored: %s'), $item->meta_value);
849
+ }
850
+
851
+ $output = '<p>' . implode('<br/>', $output) . '</p>';
852
+
853
+ $count += $limit;
854
+ if($count > $total) $count = $total;
855
+
856
+ update_option('ew-bulk-page', $page + 1);
857
+ update_option('ew-bulk-counter', $count);
858
+
859
+ echo json_encode(array(
860
+ 'progress' => get_option('ew-bulk-counter'),
861
+ 'message' => $output
862
+ ));
863
+
864
+ exit;
865
+ }
866
+
867
+ /**
868
+ * Restores original image
869
+ *
870
+ * @param integer attachment id
871
+ * @return void
872
+ */
873
+ private function restore_image($id){
874
+
875
+ $backup_file = get_post_meta($id, '_ew_backup_file', true);
876
+ $current_file = get_attached_file($id);
877
+ $filebasename = wp_basename($current_file);
878
+
879
+ // Restore main image file
880
+ $r = rename($backup_file, $current_file);
881
+
882
+ // Regenerate thumbnails
883
+ $meta = get_post_meta($id, '_wp_attachment_metadata', true);
884
+
885
+ foreach($meta['sizes'] as $size => $img){
886
+ $file = str_replace($filebasename, wp_basename($img['file']), $current_file);
887
+ unlink($file);
888
+ }
889
+
890
+ // Set flag to not watermark restored image
891
+ $this->restoring = true;
892
+
893
+ $metadata = wp_generate_attachment_metadata($id, $current_file);
894
+ if(is_wp_error($metadata)){
895
+ throw new Exception($metadata->get_error_message());
896
+ }
897
+ if(empty($metadata)) {
898
+ throw new Exception(__('Unknown failure reason.', 'easy-watermark'));
899
+ }
900
+ wp_update_attachment_metadata($id, $metadata);
901
+
902
+ // remove post metadata
903
+ delete_post_meta($id, '_ew_backup_file');
904
+ delete_post_meta($id, '_ew_watermarked');
905
+
906
+ $this->restoring = false;
907
+ }
908
+
909
/**
910
* Adds Easy Watermark column in media library
911
*
949
private function display_column_and_metabox($post_id, $page = 'library'){
950
if($post_id != $this->settings['image']['watermark_id']){
951
$watermarked = get_post_meta($post_id, '_ew_watermarked', true);
952
+ $backup_file = get_post_meta($post_id, '_ew_backup_file', null);
953
+
954
$status = $watermarked == '1' ? __('watermarked', 'easy-watermark') : __('not watermarked', 'easy-watermark');
955
echo __('Status', 'easy-watermark') . ': <strong>' . $status . '</strong><br/>';
956
968
$class = null;
969
}
970
971
+ echo '<a href="'.wp_nonce_url(admin_url('upload.php?page=easy-watermark&attachment_id='.$post_id.'&r='.$page.'&mark='.$mark), 'ew_mark').'">' . $link_text . '</a><br/><br/><p><strong><a href="' . wp_nonce_url(admin_url('upload.php?page=easy-watermark&attachment_id='.$post_id.'&r='.$page), 'ew_add_watermark') . '"'.$class.'>'.__('Add Watermark', 'easy-watermark').'</a></strong></p>';
972
+
973
+ if(!empty($backup_file)){
974
+ // We can restore original image
975
+
976
+ echo '<p><a href="' . wp_nonce_url(admin_url('upload.php?page=easy-watermark&attachment_id='.$post_id.'&r='.$page), 'ew_restore') . '"'.$class.'>'.__('Restore original image', 'easy-watermark').'</a></p>';
977
+ }
978
}
979
}
980
classes/class-ew-settings.php CHANGED
@@ -30,7 +30,8 @@ class EW_Settings
30
'image_types' => array('image/jpeg', 'image/png', 'image/gif'),
31
'image_sizes' => array('medium', 'large', 'full'),
32
'watermark_type' => 3,
33
- 'jpg_quality' => 75
34
),
35
'image' => array(
36
'watermark_url' => null,
30
'image_types' => array('image/jpeg', 'image/png', 'image/gif'),
31
'image_sizes' => array('medium', 'large', 'full'),
32
'watermark_type' => 3,
33
+ 'jpg_quality' => 75,
34
+ 'backup' => '0'
35
),
36
'image' => array(
37
'watermark_url' => null,
css/tools.css ADDED
@@ -0,0 +1,24 @@
1
+ #ew-progress {
2
+ position:relative;
3
+ display:none;
4
+ }
5
+
6
+ #ew-status {
7
+ display:none;
8
+ }
9
+
10
+ #ew-status span {
11
+ font-weight:bold;
12
+ }
13
+
14
+ #ew-finished {
15
+ display:none;
16
+ }
17
+
18
+ .progress-label {
19
+ position: absolute;
20
+ width:100%;
21
+ text-align:center;
22
+ top: 4px;
23
+ font-weight: bold;
24
+ }
index.php CHANGED
@@ -1,29 +1,30 @@
1
- <?php
2
- /*
3
- Plugin Name: Easy Watermark
4
- Description: This plugin can automatically add image and text watermark to pictures as they are uploaded to wordpress media library. You can also watermark existing images manually (all at once or an every single image). Watermark image can be a png, gif (alpha channel supported in both cases) or jpg. It's also possibile to set watermark opacity (doesn't apply to png with alpha channel). For text watermark you can select font, set color, size, angel and opacity.
5
- Version: 0.5.2
6
- Author: Wojtek Szałkiewicz
7
- Author URI: http://szalkiewicz.pl/
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
- */
11
-
12
- // Define flag, that we have plugin loaded
13
- define('EASY_WATERMARK', true);
14
-
15
- define('EWDS', DIRECTORY_SEPARATOR);
16
- define('EWBASE', dirname(__FILE__));
17
- define('EWLIB', EWBASE . EWDS . 'lib');
18
- define('EWCLASSES', EWBASE . EWDS . 'classes');
19
- define('EWVIEWS', EWBASE . EWDS . 'views');
20
-
21
- // Require all needed files
22
- require_once EWCLASSES . EWDS . 'class-ew-pluggable.php';
23
- require_once EWCLASSES . EWDS . 'class-ew-plugin-core.php';
24
- require_once EWCLASSES . EWDS . 'class-ew-plugin.php';
25
- require_once EWCLASSES . EWDS . 'class-ew-settings.php';
26
- require_once EWLIB . EWDS . 'EasyWatermark.php';
27
-
28
- // Initiate plugin
29
- EW_Plugin::init();
1
+ <?php
2
+ /*
3
+ Plugin Name: Easy Watermark
4
+ Description: This plugin can automatically add image and text watermark to pictures as they are uploaded to wordpress media library. You can also watermark existing images manually (all at once or an every single image). Watermark image can be a png, gif (alpha channel supported in both cases) or jpg. It's also possibile to set watermark opacity (doesn't apply to png with alpha channel). For text watermark you can select font, set color, size, angel and opacity.
5
+ Version: 0.6.0
6
+ Author: Wojtek Szałkiewicz
7
+ Author URI: http://szalkiewicz.pl/
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+ Text Domain: easy-watermark
11
+ */
12
+
13
+ // Define flag, that we have plugin loaded
14
+ define('EASY_WATERMARK', true);
15
+
16
+ define('EWDS', DIRECTORY_SEPARATOR);
17
+ define('EWBASE', dirname(__FILE__));
18
+ define('EWLIB', EWBASE . EWDS . 'lib');
19
+ define('EWCLASSES', EWBASE . EWDS . 'classes');
20
+ define('EWVIEWS', EWBASE . EWDS . 'views');
21
+
22
+ // Require all needed files
23
+ require_once EWCLASSES . EWDS . 'class-ew-pluggable.php';
24
+ require_once EWCLASSES . EWDS . 'class-ew-plugin-core.php';
25
+ require_once EWCLASSES . EWDS . 'class-ew-plugin.php';
26
+ require_once EWCLASSES . EWDS . 'class-ew-settings.php';
27
+ require_once EWLIB . EWDS . 'EasyWatermark.php';
28
+
29
+ // Initiate plugin
30
+ EW_Plugin::init();
js/ewajax.js ADDED
@@ -0,0 +1,137 @@
1
+ (function($){
2
+
3
+ ewAjax = $.ewAjax = {
4
+ init: function(action){
5
+ this.progressbar = $('#ew-progress');
6
+ this.console = $('#ew-console');
7
+ this.status = $('#ew-status');
8
+ this.statusProgress = this.status.find('.progress');
9
+ this.statusTotal = this.status.find('.total');
10
+ this.finished = $('#ew-finished');
11
+ this.timeContainer = $('#ew-status .ew-timer');
12
+
13
+ this.label = $('.progress-label');
14
+
15
+ this.action = action;
16
+
17
+ this.progressbar.progressbar({
18
+ value: false,
19
+ change: function() {
20
+ ewAjax.label.text(Math.round(ewAjax.progressbar.progressbar('value')) + '%');
21
+ },
22
+ complete: function() {
23
+ ewAjax.label.text(ewData.complete);
24
+ }
25
+ });
26
+
27
+ this.start();
28
+ },
29
+
30
+ start: function(){
31
+
32
+ $('#ew-info').fadeOut(300, function(){
33
+ ewAjax.progressbar.fadeIn(100);
34
+
35
+ ewAjax.statusTotal.html(ewData.total_items);
36
+ ewAjax.statusProgress.html(0);
37
+ ewAjax.status.fadeIn(100);
38
+ });
39
+
40
+ this.time = 0;
41
+ this.deltaTime = 1000;
42
+ this.timer = setInterval(this.showTimer, this.deltaTime);
43
+
44
+ this.process();
45
+ },
46
+
47
+ showTimer: function(){
48
+ ewAjax.time += ewAjax.deltaTime;
49
+
50
+ var time = ewAjax.msToTime(ewAjax.time);
51
+
52
+ ewAjax.timeContainer.html(time);
53
+ },
54
+
55
+ process: function(action){
56
+
57
+ $.ajax(ewData.ajaxurl, {
58
+ data: {
59
+ _ewnonce: ewData.nonce,
60
+ action: this.action
61
+ },
62
+ dataType: 'json',
63
+ success: function(data){
64
+ console.log(data);
65
+
66
+ if(data){
67
+ ewAjax.statusProgress.html(data.progress);
68
+ ewAjax.progress = data.progress;
69
+ var val = (data.progress / ewData.total_items) * 100;
70
+
71
+ ewAjax.progressbar.progressbar('value', val);
72
+
73
+ ewAjax.console.append(data.message);
74
+
75
+ if(data.progress < ewData.total_items){
76
+ ewAjax.process();
77
+ }
78
+ else {
79
+ ewAjax.finish();
80
+ }
81
+ }
82
+ },
83
+ error: function(){
84
+ alert('error!');
85
+ }
86
+ });
87
+ },
88
+
89
+ finish: function(){
90
+ this.finished.find('.count').html(this.progress);
91
+
92
+ clearInterval(this.timer);
93
+
94
+ // this.status.slideUp(200);
95
+ this.finished.slideDown(200);
96
+ },
97
+
98
+ msToTime: function(time){
99
+ var ms = time % 1000;
100
+ time = (time - ms) / 1000;
101
+ var s = time % 60;
102
+ time = (time - s) / 60;
103
+ var m = time % 60;
104
+ var h = (time - m) / 60;
105
+
106
+ var sufix = '',
107
+ result = '';
108
+
109
+ if(h > 0){
110
+ if(m < 10){
111
+ m = '0' + m;
112
+ }
113
+
114
+ if(s < 10){
115
+ s = '0' + s;
116
+ }
117
+ result = h + ':' + m + ':' + s;
118
+ sufix = 'h';
119
+ }
120
+ else if(m > 0){
121
+ if(s < 10){
122
+ s = '0' + s;
123
+ }
124
+
125
+ result = m + ':' + s;
126
+ sufix = 'm';
127
+ }
128
+ else {
129
+ result = s;
130
+ sufix = 's';
131
+ }
132
+
133
+ return result + ' ' + sufix;
134
+ }
135
+ }
136
+
137
+ })(jQuery)
js/restore-all.js ADDED
@@ -0,0 +1,12 @@
1
+ (function($){
2
+
3
+ $(document).ready(function(){
4
+
5
+ $('#restore-all-proceed').on('click', function(e){
6
+ e.preventDefault();
7
+ $.ewAjax.init('restore_all');
8
+ });
9
+ });
10
+
11
+ })(jQuery)
12
+
js/watermark-all.js ADDED
@@ -0,0 +1,12 @@
1
+ (function($){
2
+
3
+ $(document).ready(function(){
4
+
5
+ $('#watermark-all-proceed').on('click', function(e){
6
+ e.preventDefault();
7
+ $.ewAjax.init('watermark_all');
8
+ });
9
+ });
10
+
11
+ })(jQuery)
12
+
languages/easy-watermark-fa_IR.mo ADDED
Binary file
languages/easy-watermark-fa_IR.po ADDED
@@ -0,0 +1,548 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Easy Watermark 0.5.1\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2013-09-10 16:14+0100\n"
6
+ "PO-Revision-Date: 2014-04-08 07:05-0800\n"
7
+ "Last-Translator: M.Amin Askari <call@webhunter.ir>\n"
8
+ "Language-Team: webhunter.ir <call@webhunter.ir>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.6.4\n"
13
+ "X-Poedit-KeywordsList: __;_e\n"
14
+ "X-Poedit-Basepath: /media/szaleq/Data/easy-watermark/trunk\n"
15
+ "Plural-Forms: nplurals=1; plural=0;\n"
16
+ "Language: fa\n"
17
+ "X-Poedit-SearchPath-0: /media/szaleq/Data/easy-watermark/trunk/classes\n"
18
+ "X-Poedit-SearchPath-1: /media/szaleq/Data/easy-watermark/trunk/views\n"
19
+
20
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:170
21
+ msgid "Cheatin&#8217; uh?"
22
+ msgstr "تقلب میکنی؟! هان؟!"
23
+
24
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:207
25
+ #: /media/szaleq/Data/easy-watermark/trunk/views/easy-watermark-page.php:10
26
+ msgid "Watermark successfully added."
27
+ msgstr "واترمارک با موفقیت اضافه شد!"
28
+
29
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:210
30
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:658
31
+ msgid "watermarked"
32
+ msgstr "واترمارک شده"
33
+
34
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:210
35
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:658
36
+ msgid "not watermarked"
37
+ msgstr "واترمارک نشده"
38
+
39
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:211
40
+ #, php-format
41
+ msgid "An Image has been marked as %s."
42
+ msgstr "تصویر علامت گذاری شده به عنوان %s."
43
+
44
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:217
45
+ msgid "Invalid mime type."
46
+ msgstr "نوع پرونده نا معتبر است."
47
+
48
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:220
49
+ msgid "No watermark image selected and no watermark text set."
50
+ msgstr "هیچ واترمارک تصویری و واترمارک متنی تعیین نشده."
51
+
52
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:222
53
+ msgid "Go to settings page"
54
+ msgstr "برو به صفحه تنظیمات"
55
+
56
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:226
57
+ msgid "An error has occurred."
58
+ msgstr "خطایی رخ داده است."
59
+
60
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:232
61
+ msgid ""
62
+ "Easy Watermark is active, but requires GD library to work. Please enable "
63
+ "this extension."
64
+ msgstr ""
65
+ "ایزی واترمارک فعال است اما برای اینکه کار کند به GD library نیاز دارد،لطفا "
66
+ "آنرا فعال کنید. "
67
+
68
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:232
69
+ msgid "Read more"
70
+ msgstr "اطلاعات بیشتر"
71
+
72
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:256
73
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:283
74
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:675
75
+ msgid "Add Watermark"
76
+ msgstr "اضافه کردن واترمارک"
77
+
78
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:299
79
+ msgid "Add watermark"
80
+ msgstr "اضافه کردن واترمارک"
81
+
82
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:448
83
+ #, php-format
84
+ msgid "No permission to edit file %s. Skipping..."
85
+ msgstr "سطح دسترسی برای ویرایش%s وجود ندارد .نادیده گرفتن..."
86
+
87
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:453
88
+ #, php-format
89
+ msgid "Not supported mime type of %s. Skipping..."
90
+ msgstr "نوع mime پرونده %s پشتیبانی نمیشود.نادیده گرفتن..."
91
+
92
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:459
93
+ #, php-format
94
+ msgid "Watermark successfully added to %s"
95
+ msgstr "واترمارک با موفقیت اضافه شد %s"
96
+
97
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:644
98
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-settings.php:115
99
+ #: /media/szaleq/Data/easy-watermark/trunk/views/easy-watermark-page.php:4
100
+ msgid "Easy Watermark"
101
+ msgstr "ایزی واترمارک"
102
+
103
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:659
104
+ msgid "Status"
105
+ msgstr "وضعیت"
106
+
107
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:666
108
+ msgid "mark as not watermarked"
109
+ msgstr "نشان دار به عنوان واترمارک نشده "
110
+
111
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-plugin.php:666
112
+ msgid "mark as watermarked"
113
+ msgstr "نشان دار به عنوان واترمارک شده"
114
+
115
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-settings.php:88
116
+ msgid "General"
117
+ msgstr "عمومی"
118
+
119
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-settings.php:89
120
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:29
121
+ msgid "Image"
122
+ msgstr "تصویر"
123
+
124
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-settings.php:90
125
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:30
126
+ msgid "Text"
127
+ msgstr "متن"
128
+
129
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-settings.php:317
130
+ msgid "Settings"
131
+ msgstr "تنظیمات"
132
+
133
+ #: /media/szaleq/Data/easy-watermark/trunk/classes/class-ew-settings.php:330
134
+ msgid "Donate"
135
+ msgstr "حمایت"
136
+
137
+ #: /media/szaleq/Data/easy-watermark/trunk/views/about.php:2
138
+ msgid "About"
139
+ msgstr "درباره"
140
+
141
+ #: /media/szaleq/Data/easy-watermark/trunk/views/about.php:4
142
+ msgid "Plugin Version"
143
+ msgstr "نگارش افزونه"
144
+
145
+ #: /media/szaleq/Data/easy-watermark/trunk/views/about.php:5
146
+ msgid "Plugin Author"
147
+ msgstr "نویسنده افزونه"
148
+
149
+ #: /media/szaleq/Data/easy-watermark/trunk/views/about.php:6
150
+ msgid "GD library is enabled."
151
+ msgstr "GD library فعال است."
152
+
153
+ #: /media/szaleq/Data/easy-watermark/trunk/views/about.php:6
154
+ msgid "GD library is not available! Easy Watermark can't work without it."
155
+ msgstr "GD library در دسترس نیست،ایزی واترمارک بدون آن کار نخواهد کرد!"
156
+
157
+ #: /media/szaleq/Data/easy-watermark/trunk/views/about.php:8
158
+ msgid "Plugin page in WP repository"
159
+ msgstr "صفحه ی افزونه در مخزن وردپرس"
160
+
161
+ #: /media/szaleq/Data/easy-watermark/trunk/views/about.php:10
162
+ msgid "FAQ"
163
+ msgstr "سوالات متداول"
164
+
165
+ #: /media/szaleq/Data/easy-watermark/trunk/views/about.php:12
166
+ msgid "Support"
167
+ msgstr "پشتیبانی"
168
+
169
+ #: /media/szaleq/Data/easy-watermark/trunk/views/about.php:13
170
+ msgid "Want to buy me a coffee?"
171
+ msgstr "نمیخوای منو به یه قهوه مهمون کنی؟"
172
+
173
+ #: /media/szaleq/Data/easy-watermark/trunk/views/easy-watermark-page.php:10
174
+ msgid "Go to Media Library"
175
+ msgstr "رفتن به کتابخانه رسانه ها"
176
+
177
+ #: /media/szaleq/Data/easy-watermark/trunk/views/easy-watermark-page.php:17
178
+ msgid ""
179
+ "You are about to watermark all images in the library. This action can not be "
180
+ "undone. Are you sure you want to do this?"
181
+ msgstr ""
182
+ "شما در حال وارترمارک کردن تمامی تصاویر موجود در کتابخانه می باشید،این عمل "
183
+ "قابل بازگشت نیست.آیا از انجام این کار اطمینان دارید؟!"
184
+
185
+ #: /media/szaleq/Data/easy-watermark/trunk/views/easy-watermark-page.php:19
186
+ msgid ""
187
+ "You are about to watermark all images you have uploaded ever. This action "
188
+ "can not be undone. Are you sure you want to do this?"
189
+ msgstr ""
190
+ "شما در حال وارترمارک کردن تمامی تصاویری هستید که تا کنون آپلود شده.این عمل "
191
+ "قابل بازگشت نیست.آیا از انجام این کار اطمینان دارید؟!"
192
+
193
+ #: /media/szaleq/Data/easy-watermark/trunk/views/easy-watermark-page.php:22
194
+ msgid "Proceed"
195
+ msgstr "ادامه"
196
+
197
+ #: /media/szaleq/Data/easy-watermark/trunk/views/easy-watermark-page.php:22
198
+ msgid "Cancel"
199
+ msgstr "انصراف"
200
+
201
+ #: /media/szaleq/Data/easy-watermark/trunk/views/easy-watermark-page.php:29
202
+ msgid "Add watermark to all images"
203
+ msgstr "اضافه کردن واترمارک به همه ی تصاویر"
204
+
205
+ #: /media/szaleq/Data/easy-watermark/trunk/views/easy-watermark-page.php:31
206
+ msgid "Add watermark to all images uploaded by you"
207
+ msgstr "اضافه کردن واترمارک به همه تصاویر آپلود شده توسط شما"
208
+
209
+ #: /media/szaleq/Data/easy-watermark/trunk/views/easy-watermark-page.php:33
210
+ msgid ""
211
+ "Be carefull with that option. If some images alredy has watermark, it will "
212
+ "be added though."
213
+ msgstr ""
214
+ "در مورد این گزینه مراقب باشید،اگر تصاویری قبلا واترمارک شده باشند دوباره "
215
+ "واترماک بر روی آنها اعمال خواهد شد."
216
+
217
+ #: /media/szaleq/Data/easy-watermark/trunk/views/placeholders.php:2
218
+ msgid "Placeholders"
219
+ msgstr "نگهدار محتوایی"
220
+
221
+ #: /media/szaleq/Data/easy-watermark/trunk/views/placeholders.php:4
222
+ msgid ""
223
+ "You can use this placeholders in your text watermark, it will be replaced "
224
+ "with proper value just befor applying watermark."
225
+ msgstr ""
226
+ "شما میتوانید از نگهدار محتوایی برای واترمارک متنی استفاده نمایید،نگهدار "
227
+ "محتوایی تا قبل از اعمال واترمارک با مقدار مناسب جایگزین خواهد شد."
228
+
229
+ #: /media/szaleq/Data/easy-watermark/trunk/views/placeholders.php:6
230
+ msgid "current user login"
231
+ msgstr "ورود کاربر فعلی"
232
+
233
+ #: /media/szaleq/Data/easy-watermark/trunk/views/placeholders.php:7
234
+ msgid "current user display name"
235
+ msgstr "نام کاربر فعلی"
236
+
237
+ #: /media/szaleq/Data/easy-watermark/trunk/views/placeholders.php:8
238
+ msgid "current user email address"
239
+ msgstr "آدرس ایمیل کاربر فعلی"
240
+
241
+ #: /media/szaleq/Data/easy-watermark/trunk/views/placeholders.php:9
242
+ msgid "site admin email"
243
+ msgstr "آدرس ایمیل مدیر سایت "
244
+
245
+ #: /media/szaleq/Data/easy-watermark/trunk/views/placeholders.php:10
246
+ msgid "blog title"
247
+ msgstr "عنوان بلاگ"
248
+
249
+ #: /media/szaleq/Data/easy-watermark/trunk/views/placeholders.php:11
250
+ msgid "blog url"
251
+ msgstr "آدرس بلاگ"
252
+
253
+ #: /media/szaleq/Data/easy-watermark/trunk/views/placeholders.php:12
254
+ msgid "current date (see general settings for date format)"
255
+ msgstr "تاریخ جاری(تنظیمات عمومی برای فرمت تاریخ را مشاهده کنید)"
256
+
257
+ #: /media/szaleq/Data/easy-watermark/trunk/views/placeholders.php:13
258
+ msgid "current time"
259
+ msgstr "زمان جاری"
260
+
261
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:3
262
+ msgid "Auto Watermark"
263
+ msgstr "واترمارک خودکار"
264
+
265
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:4
266
+ msgid "Add watermark when uploading images"
267
+ msgstr "اضافه کردن واترمارک هنگام آپلود تصاویر"
268
+
269
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:6
270
+ msgid "Image Types"
271
+ msgstr "انواع تصاویر"
272
+
273
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:10
274
+ msgid "Select image types which should be watermarked"
275
+ msgstr "انتخاب کنید بر روی چه نوع تصویری واترمارک اعمال شود"
276
+
277
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:12
278
+ msgid "Image Sizes"
279
+ msgstr "اندازه تصاویر"
280
+
281
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:23
282
+ msgid "Select image sizes which should be watermarked"
283
+ msgstr "انتخاب کنید بر روی چه اندازه ای از تصاویر واترمارک اعمال شود"
284
+
285
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:26
286
+ msgid "Watermark Type"
287
+ msgstr "نوع واترمارک"
288
+
289
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:31
290
+ msgid "Image + Text"
291
+ msgstr "تصویر+متن"
292
+
293
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:33
294
+ msgid "Choose, whether to apply image, text, or both."
295
+ msgstr "انتخاب کنید کدامیک به کار برده شود،تصویر،متن و یا هردو."
296
+
297
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:36
298
+ msgid "Jpeg Quality"
299
+ msgstr "کیفیت Jpeg"
300
+
301
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:37
302
+ msgid ""
303
+ "Set jpeg quality from 0 (worst quality, smaller file) to 100 (best quality, "
304
+ "biggest file)"
305
+ msgstr ""
306
+ "کیفیت تصاویر را تعیین نمایید،0 کیفیت پایین و فایل کوچک و 100 بهترین کیفیت و "
307
+ "فایل بزرگتر"
308
+
309
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:39
310
+ msgid "Date Format"
311
+ msgstr "فرمت تاریخ"
312
+
313
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:40
314
+ msgid "Leave blank to use default date format (see general settings)"
315
+ msgstr "برای استفاده از تنظیمات پیشفرض تاریخ این گزینه را خالی بگذارید"
316
+
317
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:42
318
+ msgid "Time Format"
319
+ msgstr "فرمت زمان"
320
+
321
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:43
322
+ msgid "Leave blank to use default time format"
323
+ msgstr "برای استفاده از تنظیمات پیشفرض زمان این گزینه را خالی بگذارید"
324
+
325
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:46
326
+ msgid "User Roles"
327
+ msgstr "نقشهای کاربری"
328
+
329
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:47
330
+ msgid ""
331
+ "Select, which user roles can have a permission to apply watermarks (only "
332
+ "roles with permission to upload files are listed here)"
333
+ msgstr "تعیین کنید چه نقش کاربری سطوح دسترسی برای اعمال واترمارک را داشته باشد"
334
+
335
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:59
336
+ msgid "allow"
337
+ msgstr "اجازه دادن"
338
+
339
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:60
340
+ msgid "deny"
341
+ msgstr "رد کردن"
342
+
343
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:64
344
+ msgid "Allow to Auto Watermark"
345
+ msgstr "اجازه برای واترمارک خودکار"
346
+
347
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:65
348
+ msgid ""
349
+ "Check this to allow watermarking on upload to every user. If unchecked, "
350
+ "'Auto Watermark' function will be dependent on above role-based settings."
351
+ msgstr ""
352
+ "این گزینه را انتخاب کنید تا به تمام کاربران اجازه ی واترمارک در آپلود را "
353
+ "بدهید،در صورت عدم انتخاب، واتر مارک خودکار تنها برای کاربران با نقشهای بالا "
354
+ "کار خواهد کرد. "
355
+
356
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:68
357
+ msgid "Post Types"
358
+ msgstr "انواع نوشته ها"
359
+
360
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:69
361
+ msgid "Select what post type attachments should be automatically watermarked"
362
+ msgstr "انتخاب کنید چه نوع پیوستی در نوشته ها به صورت خودکار واترمارک شود"
363
+
364
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:72
365
+ msgid "Select All"
366
+ msgstr "انتخاب همه"
367
+
368
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:75
369
+ msgid "Unattached Images"
370
+ msgstr "تصاویر ضمیمه نشده"
371
+
372
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:75
373
+ msgid "uploaded through the media library page"
374
+ msgstr "آپلود از طریق صفحه کتابخانه رسانه ها"
375
+
376
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:76
377
+ msgid "Posts"
378
+ msgstr "نوشته ها"
379
+
380
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-general.php:77
381
+ msgid "Pages"
382
+ msgstr "صفحات"
383
+
384
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:3
385
+ msgid "Watermark Image"
386
+ msgstr "تصویر واترمارک"
387
+
388
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:8
389
+ msgid "Choose Watermark Image"
390
+ msgstr "گزینش تصویر واترمارک"
391
+
392
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:8
393
+ msgid "Set as Watermark Image"
394
+ msgstr "انتخاب به عنوان تصویر واترمارک"
395
+
396
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:8
397
+ msgid "Select/Upload Image"
398
+ msgstr "انتخاب و آپلود تصویر"
399
+
400
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:8
401
+ msgid ""
402
+ "Note: If you want to upload a new image, make sure that \"Auto watermark\" "
403
+ "option is unticked or text watermark is not set. Otherwise uploaded image "
404
+ "will be watermarked."
405
+ msgstr ""
406
+ "توجه،درصورتی که قصد دارین تصویر جدیدی را آپلود نمایید باید تیک مربوط به "
407
+ "واترمارک خودکار را بردارید در غیر اینصورت تصویر آپلود شده هم دارای واترمارک "
408
+ "خواهد شد."
409
+
410
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:17
411
+ msgid "Click on image to change it."
412
+ msgstr "برای تغییر تصویر بر روی آن کلیک نمایید."
413
+
414
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:17
415
+ msgid "Remove image"
416
+ msgstr "حذف تصویر"
417
+
418
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:18
419
+ msgid ""
420
+ "Note: If you want to upload a new image, make sure that \"Auto watermark\" "
421
+ "option is unticked, or remove current image and unset text watermark first. "
422
+ "Otherwise uploaded image will be watermarked."
423
+ msgstr ""
424
+ "توجه،درصورتی که قصد دارین تصویر جدیدی را آپلود نمایید باید تیک مربوط به "
425
+ "واترمارک خودکار را بردارید در غیر اینصورت تصویر آپلود شده هم دارای واترمارک "
426
+ "خواهد شد."
427
+
428
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:21
429
+ msgid "Image Alignment"
430
+ msgstr "موقعیت تصویر"
431
+
432
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:34
433
+ msgid "Scaling Mode"
434
+ msgstr "حالت متناسب کردن"
435
+
436
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:36
437
+ msgid "None"
438
+ msgstr "هیچ"
439
+
440
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:37
441
+ msgid "Fill"
442
+ msgstr "پر کردن"
443
+
444
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:38
445
+ msgid "Fit"
446
+ msgstr "اندازه"
447
+
448
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:39
449
+ msgid "Fit to Width"
450
+ msgstr "متناسب کردن در عرض"
451
+
452
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:40
453
+ msgid "Fit to Height"
454
+ msgstr "متناسب کردن در ارتفاع"
455
+
456
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:41
457
+ msgid "Select how to scale watermark image."
458
+ msgstr "نحوه متناسب سازی تصاویر واترمارک را انتخاب کنید."
459
+
460
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:42
461
+ msgid "Scale to Smaller"
462
+ msgstr "تناسب برای کوچکتر"
463
+
464
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:43
465
+ msgid ""
466
+ "If this is checked, watermark will be scaled only for images smaller than "
467
+ "watermark image."
468
+ msgstr ""
469
+ "اگر این گزینه انتخاب شده باشد واترمارک فقط برای تصاویر کوچکتر از خودش متناسب "
470
+ "می شود."
471
+
472
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:46
473
+ msgid "Scale"
474
+ msgstr "نسبت اندازه"
475
+
476
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:49
477
+ msgid "Image Offset"
478
+ msgstr "جابجایی تصویر"
479
+
480
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:50
481
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-text.php:29
482
+ msgid "x"
483
+ msgstr "x"
484
+
485
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:52
486
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-text.php:31
487
+ msgid "y"
488
+ msgstr "y"
489
+
490
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:53
491
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-text.php:32
492
+ msgid ""
493
+ "Offset can be defined in pixels (just numeric value) or as percentage (e.g. "
494
+ "'33%')"
495
+ msgstr "جابجایی فقط در پیکسل و به صورت عدد و یا درصد تعریف شده است،مثلا 33%!"
496
+
497
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:55
498
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-text.php:62
499
+ msgid "Opacity"
500
+ msgstr "میزان شفافیت"
501
+
502
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-image.php:55
503
+ msgid "Opacity does not affect the png images with alpha chanel."
504
+ msgstr "میزان شفافیت بر روی تصاویر PNG با چنل آفلا تاثیر نمی گذارد."
505
+
506
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-text.php:2
507
+ msgid "Watermark Text"
508
+ msgstr "متن واترمارک"
509
+
510
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-text.php:3
511
+ msgid "You can use placeholders listed on the right side of this page"
512
+ msgstr "شما میتوانید از نگهدارنده محتوا در سمت راست این صفحه استفاده نمایید."
513
+
514
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-text.php:7
515
+ msgid "Preview"
516
+ msgstr "مشاهده"
517
+
518
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-text.php:15
519
+ msgid "Text Alignment"
520
+ msgstr "موقعیت متن"
521
+
522
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-text.php:28
523
+ msgid "Text Offset"
524
+ msgstr "انحراف متن"
525
+
526
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-text.php:34
527
+ msgid "Font"
528
+ msgstr "فونت و قلم"
529
+
530
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-text.php:45
531
+ msgid "Text Color"
532
+ msgstr "رنگ متن"
533
+
534
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-text.php:54
535
+ msgid "Text Size"
536
+ msgstr "سایز متن"
537
+
538
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-form-text.php:58
539
+ msgid "Text Angle"
540
+ msgstr "زاویه متن"
541
+
542
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-page.php:6
543
+ msgid "Easy Watermark Settings"
544
+ msgstr "تنظیمات ایزی واترمارک"
545
+
546
+ #: /media/szaleq/Data/easy-watermark/trunk/views/settings-page.php:22
547
+ msgid "Save Changes"
548
+ msgstr "ذخیره تغییرات"
readme.txt CHANGED
@@ -1,148 +1,163 @@
1
- === Easy Watermark ===
2
- Contributors: szaleq
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=wojtek%40szalkiewicz%2epl&lc=GB&item_name=Easy%20Watermark%20Wordpress%20Plugin&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted
4
- Tags: watermark, image, picture, photo, media, gallery, signature, transparent, upload, admin
5
- Requires at least: 3.5
6
- Tested up to: 3.9.0
7
- Stable tag: 0.5.2
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- Automatically adds watermark to images when they are uploaded to the WordPress Media Library.
12
-
13
- == Description ==
14
-
15
- Easy Watermark can automatically add image and text watermark to pictures as they are uploaded to wordpress media library. You can also watermark existing images manually (all at once or an every single image).
16
-
17
- = Plugin features =
18
- * image watermark can be a jpg, png or gif
19
- * full support for transparency and alpha chanel in png and gif files
20
- * jpg files, gif files and text can have opacity set (from 0 to 100%)
21
- * text watermark is created using ttf fonts
22
- * text color, size and rotation can be set
23
- * all built-in image sizes can be watermarked (thumbnail, medium, large and fullsize) as well as all additional sizes registered by themes or plugins (since 0.4.3)
24
- * fully translatable
25
-
26
- = Translations included =
27
- * Polish
28
- * French (by Regis Brisard)
29
- * Spanish ([http://abitworld.com/](http://abitworld.com/ "Translator's home page"))
30
- * Russian
31
-
32
- If you have made a translation and want to contribute with it to Easy Watermark, please e-mail me.
33
-
34
- == Installation ==
35
-
36
- Note: Easy Watermark requires GD extension installed and enabled on a server to work.
37
-
38
- 1. Unpack easy-watermark.zip and upload its content to the `/wp-content/plugins/` directory
39
- 1. Activate the plugin through the 'Plugins' menu in WordPress
40
- 1. Plugin is working. Go to "Settings > Easy Watermark Settings" to set up your watermark.
41
-
42
- == Frequently asked questions ==
43
-
44
- = Can I remove watermark after it was added? =
45
- Unfortunately, not yet. Keeping oryginal pictures feature is in plans, so it will be possibile to restore original image in the future.
46
-
47
- = How can I add watermark to pictures that were uploaded before the plugin was installed? =
48
- You can go to "Media >> Easy Watermark" and click "Add watermark to all images" button. If you want to add watermark to single images, you can find links titled "Add watermark" in the media library (see screenshots) or "Add watermark" button on image edit page.
49
-
50
- = How can I adjust watermark image position? =
51
- Watermark position can be adjusted vertically and horizontally by selecting alignment (left, center, right, top, middle, bottom). You can also define horizontal and vertical offset.
52
-
53
- = Can I add both, text and image watermark at once? =
54
- Yes, there is a posibility to add only image, only text or both.
55
-
56
- = How Can I adjust text watermark? =
57
- You can choose text font from the list of ten fonts included to this plugin. In future releases you will be able to upload your own font file. You can also set font size, color, angel and opacity. Position of text watermark can be adjusted exactly like image position.
58
-
59
- = Can I use my font for text watermark? =
60
- There is no user-friendly way to do this, however if you know what you do, you can upload your truetype font file to the %plugin_dir%/fonts. Then edit %plugin_dir%/lib/EasyWatermarkSettings.php and add your font file name to $fonts array.
61
-
62
- = How the scaling of the watermark image works? =
63
- On the watermark image settings page you can se 'Scaling Mode' selection which has 5 options:
64
- * 'None' - watermark scaling is off
65
- * 'Fill' - watermark will fill the entire image
66
- * 'Fit' - watermark width or height will be adjusted to image width or height in such a way that it will be all visible
67
- * 'Fit to Width' - watermark width will always be adjusted to image width
68
- * 'Fit to Height' - watermark height will always be adjusted to image height
69
- If 'Scale to Smaller' checkbox is checked, any scaling will be done only for images smaller than watermark image.
70
- Watermark ratio is always preserved, so it can go beyond the image when the 'Scaling Mode' is set to 'Fill'.
71
- With 'Fit to Width' or 'Fit to Height' options watermark dimensions can be set as a percentage in relation to the image dimensions.
72
-
73
- = What placeholders can I use in text watermark? =
74
- All available placeholders are listed in a box titled 'Placeholders' on the text watermark settings page, under the 'About' box.
75
-
76
- == Screenshots ==
77
-
78
- 1. General settings page
79
- 2. Image settings page
80
- 3. Text settings page
81
- 4. Easy Watermark Tool
82
- 5. 'Add Watermark' link in media library
83
-
84
- == Changelog ==
85
-
86
- = 0.5.2 =
87
- * Fix: watermarking class optimised to avoid out-of-memory errors
88
- * Fix: settings are now kept after deactivation
89
- * Fix: many small bugs in a code
90
- * Added: bunch of new text placeholders
91
- * small changes in UI
92
-
93
- = 0.5.1 =
94
- * fixed cooperation with front-end upload plugins (like BuddyPress Media)
95
- * added possibility to define which post type attachments should be watermarked on upload
96
-
97
- = 0.5 =
98
- * fixed issue with watermarking not selected image types on upload
99
- * png transparency in watermarked images is now preserved
100
- * added possibility to disable watermarking feature for particular roles
101
- * user which can only add posts (like 'author') can only add watermark to the images uploaded by him
102
- * introduced placeholders in text watermark
103
- * color picker changed to Iris (integrated with wordpress)
104
- * added information about image status (watermarked or not)
105
- * added 'Easy Watermark' column in media table and metabox on an image editing page
106
- * a lot of 'invisible' changes in the code
107
-
108
- = 0.4.4 =
109
- * repaired issue with auto-watermark option
110
-
111
- = 0.4.3 =
112
- * added support for additional image sizes registered by some templates or plugins (e.g. 'post-thumbnail')
113
-
114
- = 0.4.2 =
115
- * added possibility to define jpeg quality
116
-
117
- = 0.4.1 =
118
- * added an option to scale watermark only for smaller images
119
- * added confirmation button for 'Add watermark to all images' action
120
- * some changes in the code to make the plugin more compatible
121
-
122
- = 0.4 =
123
- * introduced watermark image scaling option
124
-
125
- = 0.3 =
126
- * added support for all image sizes (thumbnail, medium, large), not only the fullsize image
127
- * plugin now checks if the GD library is available, if not, it'll inform you about it instead of throw errors
128
-
129
- = 0.2.3 =
130
- * added bulk action on media library page
131
-
132
- = 0.2.2 =
133
- * added live text preview on the settings page
134
-
135
- = 0.2.1 =
136
- * some changes on settings page
137
-
138
- = 0.2 =
139
- * added text watermark handling
140
- * corrected issue with auto adding watermark on upload
141
-
142
- = 0.1.1 =
143
- * offset can be now also a percentage, not only pixel value
144
- * changed code structure
145
- * separete class responsible only for watermarking (can be used alone)
146
-
147
- = 0.1 =
148
- * Initial release
1
+ === Easy Watermark ===
2
+ Contributors: szaleq
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=wojtek%40szalkiewicz%2epl&lc=GB&item_name=Easy%20Watermark%20Wordpress%20Plugin&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted
4
+ Tags: watermark, image, picture, photo, media, gallery, signature, transparent, upload, admin
5
+ Requires at least: 3.5
6
+ Tested up to: 4.3.1
7
+ Stable tag: 0.6.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+ Text Domain: easy-watermark
11
+
12
+ Allows to add watermark to images automatically on upload or manually.
13
+
14
+ == Description ==
15
+
16
+ Easy Watermark can automatically add watermark to images as they are uploaded to wordpress media library. You can also watermark existing images manually (all at once or an every single image). Watermark can be an image, text or both.
17
+
18
+ = Plugin features =
19
+ * image watermark can be a jpg, png or gif
20
+ * full support for transparency and alpha chanel in png and gif files
21
+ * jpg files, gif files and text can have opacity set (from 0 to 100%)
22
+ * text watermark is created using ttf fonts
23
+ * text color, size and rotation can be set
24
+ * all built-in image sizes can be watermarked (thumbnail, medium, large and fullsize) as well as all additional sizes registered by themes or plugins (since 0.4.3)
25
+ * since 0.6 there is a possibility to remove watermark by restoring the original image
26
+ * fully translatable
27
+
28
+ = Translations included =
29
+ * Polish
30
+ * French (by Regis Brisard)
31
+ * Spanish ([http://abitworld.com/](http://abitworld.com/ "Translator's home page"))
32
+ * Russian
33
+ * Persian
34
+
35
+ If you have made a translation and want to contribute with it to Easy Watermark, please e-mail me.
36
+
37
+ == Installation ==
38
+
39
+ Note: Easy Watermark requires GD extension installed and enabled on a server to work.
40
+
41
+ 1. Unpack easy-watermark.zip and upload its content to the `/wp-content/plugins/` directory
42
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
43
+ 1. Plugin is working. Go to "Settings > Easy Watermark" to set up your watermark.
44
+
45
+ == Frequently asked questions ==
46
+
47
+ = Can I remove watermark after it was added? =
48
+ Yes, since version 0.6.0 there is an option to "remove" watermark by restorin the original image. Backup feature is disabled by default, you can enable it on the "Settings > Easy Watermark". Note: this will use more space on your server due to the fact that the images will be stored twice.
49
+ Only the fullsize image is stored in backup, thumbnails are regenerated during the restoring process.
50
+ To restore the original image just go to the attachment edit page. In the "Easy Watermark" meta box you can find the "Restore original image" button. Just click it.
51
+
52
+ = How can I restore original images after the plugin was uninstalled? =
53
+ The plugin doesn't restore your images on deactivation/removal. Please consider to install the plugin again and restore your images before uninstalling.
54
+ If you don't have a possibility to do this, you can manually restore your images. Just go to wp-content/ew_backup in your wordpress main directory. You will se there are folders in the same order like in uploads, images are stored as /year/month/imagename.jpg|png|whatever. What you need is to copy all the files from ew_backup to uploads dir (it will ask you if you want to override the existing files, click YES). As mensioned before, this will restore only the fullsize images so you need to use some other plugin to generate the thumbnails again (see Force Regenerate Thumbnails by Pedro Elsner).
55
+
56
+ = How can I add watermark to pictures that were uploaded before the plugin was installed? =
57
+ You can go to "Media >> Easy Watermark" and click "Add watermark to all images" button. If you want to add watermark to single images, you can find links titled "Add watermark" in the media library (see screenshots) or "Add watermark" button on image edit page.
58
+
59
+ = How can I adjust watermark image position? =
60
+ Watermark position can be adjusted vertically and horizontally by selecting alignment (left, center, right, top, middle, bottom). You can also define horizontal and vertical offset.
61
+
62
+ = Can I add both, text and image watermark at once? =
63
+ Yes, there is a posibility to add only image, only text or both.
64
+
65
+ = How Can I adjust text watermark? =
66
+ You can choose text font from the list of ten fonts included to this plugin. In future releases you will be able to upload your own font file. You can also set font size, color, angel and opacity. Position of text watermark can be adjusted exactly like image position.
67
+
68
+ = Can I use my font for text watermark? =
69
+ There is no user-friendly way to do this, however if you know what you do, you can upload your truetype font file to the %plugin_dir%/fonts. Then edit %plugin_dir%/lib/EasyWatermarkSettings.php and add your font file name to $fonts array.
70
+
71
+ = How the scaling of the watermark image works? =
72
+ On the watermark image settings page you can se 'Scaling Mode' selection which has 5 options:
73
+ * 'None' - watermark scaling is off
74
+ * 'Fill' - watermark will fill the entire image
75
+ * 'Fit' - watermark width or height will be adjusted to image width or height in such a way that it will be all visible
76
+ * 'Fit to Width' - watermark width will always be adjusted to image width
77
+ * 'Fit to Height' - watermark height will always be adjusted to image height
78
+ If 'Scale to Smaller' checkbox is checked, any scaling will be done only for images smaller than watermark image.
79
+ Watermark ratio is always preserved, so it can go beyond the image when the 'Scaling Mode' is set to 'Fill'.
80
+ With 'Fit to Width' or 'Fit to Height' options watermark dimensions can be set as a percentage in relation to the image dimensions.
81
+
82
+ = What placeholders can I use in text watermark? =
83
+ All available placeholders are listed in a box titled 'Placeholders' on the text watermark settings page, under the 'About' box.
84
+
85
+ == Screenshots ==
86
+
87
+ 1. General settings page
88
+ 2. Image settings page
89
+ 3. Text settings page
90
+ 4. Easy Watermark Tool
91
+ 5. Easy Watermark metabox on attachment page
92
+
93
+ == Changelog ==
94
+
95
+ = 0.6.0 =
96
+ * Added: backup option for watermarked images - allows to restore original image
97
+ * Added: button to restore all original images on the plugins page
98
+ * Changed method of watermarking all images
99
+ * it now uses ajax and watermarks 10 images at once so it needs less time and memory per request
100
+
101
+ = 0.5.2 =
102
+ * Fix: watermarking class optimised to avoid out-of-memory errors
103
+ * Fix: settings are now kept after deactivation
104
+ * Fix: many small bugs in a code
105
+ * Added: bunch of new text placeholders
106
+ * small changes in UI
107
+
108
+ = 0.5.1 =
109
+ * fixed cooperation with front-end upload plugins (like BuddyPress Media)
110
+ * added possibility to define which post type attachments should be watermarked on upload
111
+
112
+ = 0.5 =
113
+ * fixed issue with watermarking not selected image types on upload
114
+ * png transparency in watermarked images is now preserved
115
+ * added possibility to disable watermarking feature for particular roles
116
+ * user which can only add posts (like 'author') can only add watermark to the images uploaded by him
117
+ * introduced placeholders in text watermark
118
+ * color picker changed to Iris (integrated with wordpress)
119
+ * added information about image status (watermarked or not)
120
+ * added 'Easy Watermark' column in media table and metabox on an image editing page
121
+ * a lot of 'invisible' changes in the code
122
+
123
+ = 0.4.4 =
124
+ * repaired issue with auto-watermark option
125
+
126
+ = 0.4.3 =
127
+ * added support for additional image sizes registered by some templates or plugins (e.g. 'post-thumbnail')
128
+
129
+ = 0.4.2 =
130
+ * added possibility to define jpeg quality
131
+
132
+ = 0.4.1 =
133
+ * added an option to scale watermark only for smaller images
134
+ * added confirmation button for 'Add watermark to all images' action
135
+ * some changes in the code to make the plugin more compatible
136
+
137
+ = 0.4 =
138
+ * introduced watermark image scaling option
139
+
140
+ = 0.3 =
141
+ * added support for all image sizes (thumbnail, medium, large), not only the fullsize image
142
+ * plugin now checks if the GD library is available, if not, it'll inform you about it instead of throw errors
143
+
144
+ = 0.2.3 =
145
+ * added bulk action on media library page
146
+
147
+ = 0.2.2 =
148
+ * added live text preview on the settings page
149
+
150
+ = 0.2.1 =
151
+ * some changes on settings page
152
+
153
+ = 0.2 =
154
+ * added text watermark handling
155
+ * corrected issue with auto adding watermark on upload
156
+
157
+ = 0.1.1 =
158
+ * offset can be now also a percentage, not only pixel value
159
+ * changed code structure
160
+ * separete class responsible only for watermarking (can be used alone)
161
+
162
+ = 0.1 =
163
+ * Initial release
views/easy-watermark-page.php CHANGED
@@ -1,8 +1,48 @@
1
2
<div class="wrap easy-watermark">
3
<div id="icon-easy-watermark" class="icon32"><br /></div>
4
- <h2><?php _e('Easy Watermark', 'easy-watermark'); ?></h2>
5
- <?php
6
if(isset($_GET['_wpnonce'])) :
7
if(wp_verify_nonce($_GET['_wpnonce'], 'watermark_all_confirmed') && isset($_GET['watermark_all']) && ($output = $this->watermark_all())) :
8
?>
@@ -19,19 +59,14 @@
19
<p><?php _e('You are about to watermark all images you have uploaded ever. This action can not be undone. Are you sure you want to do this?', 'easy-watermark'); ?></p>
20
<?php endif; ?>
21
</div>
22
<a class="button-primary" href="<?php echo wp_nonce_url(admin_url('/upload.php?page=easy-watermark&watermark_all=1'), 'watermark_all_confirmed'); ?>"><?php _e('Proceed', 'easy-watermark'); ?></a> <a class="button-secondary" href="<?php echo admin_url('/upload.php?page=easy-watermark'); ?>"><?php _e('Cancel', 'easy-watermark'); ?></a>
23
<?php endif;
24
else :
25
?>
26
- <br/>
27
- <?php
28
- if(current_user_can('edit_others_posts'))
29
- $link_text = __('Add watermark to all images', 'easy-watermark');
30
- else
31
- $link_text = __('Add watermark to all images uploaded by you', 'easy-watermark');
32
- ?>
33
- <a class="button-primary" href="<?php echo wp_nonce_url(admin_url('/upload.php?page=easy-watermark&watermark_all=1'), 'watermark_all'); ?>"><?php echo $link_text ?></a><p class="description"><?php _e('Be carefull with that option. If some images alredy has watermark, it will be added though.', 'easy-watermark'); ?></p>
34
<?php
35
endif;
36
?>
37
</div>
1
2
<div class="wrap easy-watermark">
3
<div id="icon-easy-watermark" class="icon32"><br /></div>
4
+ <h2><?php _e('Easy Watermark Tools', 'easy-watermark'); ?></h2>
5
+
6
+ <?php if(isset($current_tool)) :
7
+ include EWVIEWS . EWDS . 'tools' . EWDS . $current_tool . '.php';
8
+ else : ?>
9
+ <div id="easy-watermark-tool-bulk">
10
+ <h3><?php _e('Bulk Watermark', 'easy-watermark'); ?></h3>
11
+
12
+ <?php
13
+ if(current_user_can('edit_others_posts'))
14
+ $description = __('Using this tool you can quickly apply watermark to all images in the Media Library.', 'easy-watermark');
15
+ else
16
+ $description = __('Using this tool you can quickly apply watermark to all images you uploaded to the Media Library.', 'easy-watermark');
17
+ ?>
18
+ <p><?php echo $description; ?></p>
19
+
20
+ <a class="button-primary" href="<?php echo wp_nonce_url(admin_url('/upload.php?page=easy-watermark&watermark_all=1'), 'watermark_all'); ?>"><?php _e('Start', 'easy-watermark'); ?></a><p class="description"><?php _e('Be carefull with this option. If some images alredy has watermark, it will be added though.', 'easy-watermark'); ?></p>
21
+ </div>
22
+
23
+ <div id="easy-watermark-tool-restore">
24
+ <h3><?php _e('Restore original images', 'easy-watermark'); ?></h3>
25
+
26
+ <?php
27
+ if(current_user_can('edit_others_posts'))
28
+ $description = __('Here you can remove watermark from all images by restoring the original image files.', 'easy-watermark');
29
+ else
30
+ $description = __('Here you can remove watermark from the images you uploaded by restoring the original image files.', 'easy-watermark');
31
+ ?>
32
+ <p><?php echo $description; ?></p>
33
+
34
+ <a class="button-primary" href="<?php echo wp_nonce_url(admin_url('/upload.php?page=easy-watermark&restore_all=1'), 'restore_all'); ?>"><?php _e('Restore', 'easy-watermark'); ?></a>
35
+
36
+ </div>
37
+
38
+ <?php endif; ?>
39
+
40
+
41
+
42
+
43
+
44
+
45
+ <?php /*
46
if(isset($_GET['_wpnonce'])) :
47
if(wp_verify_nonce($_GET['_wpnonce'], 'watermark_all_confirmed') && isset($_GET['watermark_all']) && ($output = $this->watermark_all())) :
48
?>
59
<p><?php _e('You are about to watermark all images you have uploaded ever. This action can not be undone. Are you sure you want to do this?', 'easy-watermark'); ?></p>
60
<?php endif; ?>
61
</div>
62
+
63
+
64
<a class="button-primary" href="<?php echo wp_nonce_url(admin_url('/upload.php?page=easy-watermark&watermark_all=1'), 'watermark_all_confirmed'); ?>"><?php _e('Proceed', 'easy-watermark'); ?></a> <a class="button-secondary" href="<?php echo admin_url('/upload.php?page=easy-watermark'); ?>"><?php _e('Cancel', 'easy-watermark'); ?></a>
65
<?php endif;
66
else :
67
?>
68
<?php
69
endif;
70
+ */
71
?>
72
</div>
views/settings-form-general.php CHANGED
@@ -9,6 +9,9 @@
9
<label for="image-type-png"><input id="image-type-png" type="checkbox" name="easy-watermark-settings-general[image_types][]" value="image/png" <?php checked('1', in_array('image/png', $image_types)); ?> /> png</label><br/>
10
<label for="image-type-gif"><input id="image-type-gif" type="checkbox" name="easy-watermark-settings-general[image_types][]" value="image/gif" <?php checked('1', in_array('image/gif', $image_types)); ?> /> gif</label><p class="description"><?php _e('Select image types which should be watermarked', 'easy-watermark'); ?></p></td>
11
</tr>
12
<tr valign="top"><th scope="row"><?php _e('Image Sizes', 'easy-watermark'); ?></th>
13
<td>
14
<label for="image-size-thumb"><input id="image-size-thumb" type="checkbox" name="easy-watermark-settings-general[image_sizes][]" value="thumbnail" <?php checked('1', in_array('thumbnail', $image_sizes)); ?> /> Thumb</label><br/></fieldset>
9
<label for="image-type-png"><input id="image-type-png" type="checkbox" name="easy-watermark-settings-general[image_types][]" value="image/png" <?php checked('1', in_array('image/png', $image_types)); ?> /> png</label><br/>
10
<label for="image-type-gif"><input id="image-type-gif" type="checkbox" name="easy-watermark-settings-general[image_types][]" value="image/gif" <?php checked('1', in_array('image/gif', $image_types)); ?> /> gif</label><p class="description"><?php _e('Select image types which should be watermarked', 'easy-watermark'); ?></p></td>
11
</tr>
12
+ <tr valign="top"><th scope="row"><?php _e('Backup', 'easy-watermark'); ?></th>
13
+ <td><label for="easy-watermark-backup"><input id="easy-watermark-backup" name="easy-watermark-settings-general[backup]" type="checkbox" value="1" <?php checked('1', $backup); ?> /> <?php _e('Save original images to allow to restore them after watermark was applied', 'easy-watermark'); ?></label><p class="description"><?php _e('This option will use more space on your server. Please consider creating manual backup of original images on your local drive.', 'easy-watermark'); ?></p></td>
14
+ </tr>
15
<tr valign="top"><th scope="row"><?php _e('Image Sizes', 'easy-watermark'); ?></th>
16
<td>
17
<label for="image-size-thumb"><input id="image-size-thumb" type="checkbox" name="easy-watermark-settings-general[image_sizes][]" value="thumbnail" <?php checked('1', in_array('thumbnail', $image_sizes)); ?> /> Thumb</label><br/></fieldset>
views/tools/restore_all.php ADDED
@@ -0,0 +1,27 @@
1
+
2
+ <h3><?php _e('Restore original images', 'easy-watermark'); ?></h3>
3
+
4
+ <div id="ew-info">
5
+ <div id="message" class="updated below-h2">
6
+ <?php if(current_user_can('edit_others_posts')): ?>
7
+ <p><?php _e('You are about to restore all original images. This action will remove all watermarks ever applied. Are you sure you want to do this?', 'easy-watermark'); ?></p>
8
+ <?php else : ?>
9
+ <p><?php _e('You are about to restore original images for attachments you ever uploaded. This action This action will remove all watermarks ever applied. Are you sure you want to do this?', 'easy-watermark'); ?></p>
10
+ <?php endif; ?>
11
+ </div>
12
+
13
+ <a class="button-primary" href="#" id="restore-all-proceed"><?php _e('Proceed', 'easy-watermark'); ?></a> <a class="button-secondary" href="<?php echo admin_url('/upload.php?page=easy-watermark'); ?>"><?php _e('Cancel', 'easy-watermark'); ?></a>
14
+ </div>
15
+
16
+ <div id="ew-finished" class="updated below-h2">
17
+ <p><?php echo sprintf(__('%s images restored.', 'easy-watermark'), '<span class="count"></span>'); ?> <?php echo sprintf(__('%s or %s'), '<a href="' . admin_url('upload.php?page=easy-watermark') . '">' . __('Go back', 'easy-watermark') . '</a>', '<a href="' . admin_url('upload.php') . '">' . __('Go to Media Library', 'easy-watermark') . '</a></p>'); ?>
18
+ </div>
19
+
20
+ <div id="ew-progress"><div class="progress-label"><?php _e('Starting...', 'easy-watermark'); ?></div></div>
21
+
22
+ <div id="ew-status">
23
+ <p><?php echo sprintf(__('Processed %s of %s images', 'easy-watermark'), '<span class="progress"></span>', '<span class="total"></span>'); ?></p>
24
+ <p><?php echo sprintf(__('Duration: %s', 'easy-watermark'), '<strong><span class="ew-timer">0</span></strong>'); ?></p>
25
+ </div>
26
+
27
+ <div id="ew-console"></div>
views/tools/watermark_all.php ADDED
@@ -0,0 +1,27 @@
1
+
2
+ <h3><?php _e('Bulk Watermark', 'easy-watermark'); ?></h3>
3
+
4
+ <div id="ew-info">
5
+ <div id="message" class="updated below-h2">
6
+ <?php if(current_user_can('edit_others_posts')): ?>
7
+ <p><?php _e('You are about to watermark all images in the library. This action can not be undone. Are you sure you want to do this?', 'easy-watermark'); ?></p>
8
+ <?php else : ?>
9
+ <p><?php _e('You are about to watermark all images you have uploaded ever. This action can not be undone. Are you sure you want to do this?', 'easy-watermark'); ?></p>
10
+ <?php endif; ?>
11
+ </div>
12
+
13
+ <a class="button-primary" href="#" id="watermark-all-proceed"><?php _e('Proceed', 'easy-watermark'); ?></a> <a class="button-secondary" href="<?php echo admin_url('/upload.php?page=easy-watermark'); ?>"><?php _e('Cancel', 'easy-watermark'); ?></a>
14
+ </div>
15
+
16
+ <div id="ew-finished" class="updated below-h2">
17
+ <p><?php echo sprintf(__('%s images watermarked.', 'easy-watermark'), '<span class="count"></span>'); ?> <?php echo sprintf(__('%s or %s'), '<a href="' . admin_url('upload.php?page=easy-watermark') . '">' . __('Go back', 'easy-watermark') . '</a>', '<a href="' . admin_url('upload.php') . '">' . __('Go to Media Library', 'easy-watermark') . '</a></p>'); ?>
18
+ </div>
19
+
20
+ <div id="ew-progress"><div class="progress-label"><?php _e('Starting...', 'easy-watermark'); ?></div></div>
21
+
22
+ <div id="ew-status">
23
+ <p><?php echo sprintf(__('Processed %s of %s images', 'easy-watermark'), '<span class="progress"></span>', '<span class="total"></span>'); ?></p>
24
+ <p><?php echo sprintf(__('Duration: %s', 'easy-watermark'), '<strong><span class="ew-timer">0</span></strong>'); ?></p>
25
+ </div>
26
+
27
+ <div id="ew-console"></div>