12 November 2016
7 views

[Tips] プラグイン『Image Watermark』(WordPress)


今回は以下のプラグインを紹介します。

『Image Watermark』

アップするイラストにウォーターマークを入れたくて色々試した結果このプラグインにたどり着きました。
色々調べるとほかに「Easy WaterMark」があるのですが、これに落ち着きました。
決め手は画像を埋め込むときにPNG24の透過ファイルが使用できることでしょうかね。

他のプラグインだと8bitまでなので、なんかギザギザになるんですよね。
なので、24bitまで使えるこのプラグインは帳票します。

一つ他と足りないのが文字が打てないところでしょうかね。
まぁ、そこは登録する画像自体に文字を打ち込めばいいんですけどね( ゚Д゚)

Image Water 設定画面
Image Water 設定画面

2か所修正
1.一度付与したウォーターマークを外した後に再度追加した場合、サムネイルが変更できない部分を修正
※updateからdeleteに変更

799
800
801
802
803
804
805
806
807
            // Update attachment metadata with new metadata
            wp_update_attachment_metadata( $attachment_id, $metadata );

            // Update watermark status
            //update_post_meta( $attachment_id, $this->is_watermarked_metakey, false );
            delete_post_meta( $attachment_id, $this->is_watermarked_metakey, false );

            // Return the attachment metadata
            return wp_get_attachment_metadata( $attachment_id );

2.バックアップフォルダを変更
※「iw-backup」部分を変更

115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
        // filters
        add_filter( 'plugin_row_meta', array( $this, 'plugin_extend_links' ), 10, 2 );
        add_filter( 'plugin_action_links', array( $this, 'plugin_settings_link' ), 10, 2 );
        add_filter( 'wp_handle_upload', array( $this, 'handle_upload_files' ) );
        add_filter( 'attachment_fields_to_edit', array( $this, 'attachment_fields_to_edit' ), 10, 2 );

        // Define our backup location
        $upload_dir = wp_upload_dir();
        define( 'IMAGE_WATERMARK_BACKUP_DIR', apply_filters( 'image_watermark_backup_dir', $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'iw-backup' ) );

        // create backup folder and security if enabled
        if ( $this->options['backup']['backup_image'] ) {

            if ( is_writable( $upload_dir['basedir'] ) ) {
                $this->is_backup_folder_writable = true;
しゃとら

no-data