For Users

Installation

First way to install plugin:

  1. Download plugin from your BeRocket account
  2. Open your site admin panel and go to Plugins -> Add New -> Upload Plugin
  3. Click Browse and select downloaded zip file and click Install Now
  4. Click Activate Plugin

 

Second way to install plugin:  

  1. Download plugin from your BeRocket account
  2. Open your site via FTP
  3. Go to WordPress folder/wp-content/plugins
  4. Extract files from downloaded zip file and copy extracted folders to plugins folder
  5. Open your site admin panel and go to Plugins
  6. Find WooCommerce Products Image Watermark and click Activate under it

Setup

Watermarks

  • Open plugin settings Admin Panel -> WooCommerce -> Products Image Watermark
  • Select watermark or enter text for needed image type
  • More details

Account/Product Key

BeRocket Account and Product key uses for auto update plugins from BeRocket site.

Where can you find Account Key?

  1. Open BeRocket site and Login (The Login button you can find in header menu)
  2. Go to My Account (The My Account button you can find in header menu)
  3. From right side on page you can find all information about your BeRocket account including Account Key

  4. You can click on account key and copy it
  5. What can you do with Account Key?

Where can you find Product Key?

  1. Open BeRocket site and Login (The Login button you can find in header menu)
  2. Go to My Account (The My Account button you can find in header menu)
  3. Click on key icon on right side from plugin name WooCommerce Products Compare

  4. You can click on Product key and copy it
  5. In left field you can type any notice for this key and click DONE to save
  6. What can you do with Product Key?

Settings

WooCommerce Products Compare have settings in Admin Panel -> WooCommerce -> Products Image Watermark

General

Contains general settings for Image watermarks.

  • Disable image replace? - disable adding watermarks to image, but doesn't remove watermarks from images where that was added
  • There is three blocks with same settings:
    • Main image on the top of product page - watermark for main image on product pages
    • Product image in category - watermark for images on shop page, categories pages and other pages with list of products
    • Additional product images that appear under the main product image - watermark for other images on shop page
  • Text on image - text that will be added to images as watermark
  • Repeat text - repeat text across the picture
  • Angle - rotate angle of text
  • Font size - font size in pixels. Can be from 8 to 72
  • Font color - text color
  • Font transparency - transparency of the text. Can be from 0 to 100
  • Image count - count of images, that will be added as watermark to product image
  • Image selector:
    • Upload button - select image from media library or upload new one
    • Remove button - clear field with images
    • Position and Size block - you can move gray block with help of drag and drop and resize it
  • Restore Images button -  restore images without watermarks, please use only with Disable image replace, because without this all resored images will be replaced again to image with watermark

CSS

Contains setting to set custom CSS code that will be added to frontend pages.

  • Custom CSS - any CSS code, that you want

License

Plugin key - uses for updates plugin from BeRocket site. You can get this on BeRocket site -> My Account page on click key icon

BeRocket Account

BeRocket account settings are in Admin Panel -> Settings -> BeRocket Account.

Contains field for place BeRocket Account Key

Where can you find Account Key?

  1. Copy Account Key from BeRocket site
  2. Paste this key to Account key field
  3. Press Test button
  4. If you use right Account Key you will see

  5. Then press Save button

For Developers

Filter hooks

image_watermark_get_template_part

Template that uses in plugin.

Parameters

  1. template - link to template that will be loaded.
  2. name - template name.

Usage

<?php
function change_image_watermark_get_template_part ( $template, $name ) {
//your code here
    return $template;
}

add_filter( 'image_watermark_get_template_part', 'change_image_watermark_get_template_part', 10, 2 );
?>

br_watermark_check_types

When wordpress trying to get image with size from this array, then plugin enable script to add watermark to images for this product.

Parameters

  1. types - array with image sizes: shop_catalog, shop_single, shop_thumbnail.

Usage

<?php
function change_br_watermark_check_types ( $types ) {
//your code here
    return $types;
}

add_filter( 'br_watermark_check_types', 'change_br_watermark_check_types', 10, 2 );
?>

br_watermark_replace_types

Array of image sizes to add watermarks.

Parameters

  1. types - array with image sizes: shop_catalog, shop_thumbnail, thumbnail, shop_single, full.

Usage

<?php
function change_br_watermark_replace_types ( $types ) {
//your code here
    return $types;
}

add_filter( 'br_watermark_replace_types', 'change_br_watermark_replace_types', 10, 2 );
?>

Functions

includes/functions.php

br_get_woocommerce_version()

Public function to get WooCommerce version

return string. woocommerce version

woocommerce-products-image-watermark.php

All of these functions is in class BeRocket_image_watermark as static functions.

admin_init ()

Function for initialize scripts and settings page in admin panel.

options ()

Add option page to admin menu.

br_get_template_part( $name = '' )

Get template part.

  • $name - template name

Default templates places in plugins folder woocommerce-products-image-watermark/templates.

To rewrite the template in your theme folder create folder with name woocommerce-image_watermark and places new template with identical name in this folder.

add_watermark_to_images( $post_id )

Add watermark to images attached to product with id $post_id.

  • $post_id - product id

Options

All settings you can find in BeRocket_image_watermark class in static variables $defaults.

public static $defaults = array(
        'disable_image'     => '0',
        'shop_thumbnail'    => array(
            'ratio'             => array(0 => '1', 1 => '1', 2 => '1', 3 => '1', 4 => '1'),
            'text'              => '',
            'text_alpha'        => '30',
            'text_angle'        => '0',
            'font_size'         => '20',
            'image_count'       => '0',
            'image'             => array(0 => '', 1 => '', 2 => '', 3 => '', 4 => ''),
            'top'               => array(0 => '25', 1 => '25', 2 => '25', 3 => '25', 4 => '25'),
            'left'              => array(0 => '25', 1 => '25', 2 => '25', 3 => '25', 4 => '25'),
            'width'             => array(0 => '50', 1 => '50', 2 => '50', 3 => '50', 4 => '50'),
            'height'            => array(0 => '50', 1 => '50', 2 => '50', 3 => '50', 4 => '50'),
        ),
        'shop_single'       => array(
            'ratio'             => array(0 => '1', 1 => '1', 2 => '1', 3 => '1', 4 => '1'),
            'text'              => '',
            'text_alpha'        => '30',
            'text_angle'        => '0',
            'font_size'         => '20',
            'image_count'       => '0',
            'image'             => array(0 => '', 1 => '', 2 => '', 3 => '', 4 => ''),
            'top'               => array(0 => '25', 1 => '25', 2 => '25', 3 => '25', 4 => '25'),
            'left'              => array(0 => '25', 1 => '25', 2 => '25', 3 => '25', 4 => '25'),
            'width'             => array(0 => '50', 1 => '50', 2 => '50', 3 => '50', 4 => '50'),
            'height'            => array(0 => '50', 1 => '50', 2 => '50', 3 => '50', 4 => '50'),
        ),
        'shop_catalog'      => array(
            'ratio'             => array(0 => '1', 1 => '1', 2 => '1', 3 => '1', 4 => '1'),
            'text'              => '',
            'text_alpha'        => '30',
            'text_angle'        => '0',
            'font_size'         => '20',
            'image_count'       => '0',
            'image'             => array(0 => '', 1 => '', 2 => '', 3 => '', 4 => ''),
            'top'               => array(0 => '25', 1 => '25', 2 => '25', 3 => '25', 4 => '25'),
            'left'              => array(0 => '25', 1 => '25', 2 => '25', 3 => '25', 4 => '25'),
            'width'             => array(0 => '50', 1 => '50', 2 => '50', 3 => '50', 4 => '50'),
            'height'            => array(0 => '50', 1 => '50', 2 => '50', 3 => '50', 4 => '50'),
        ),
        'custom_css'        => '',
        'plugin_key'        => '',
    );

Files

  • woocommerce-products-image-watermark.php - main plugin file
  • css - folder with CSS files
    • admin.css - styles for admin panel
    • colpick.css - styles for color picker block
    • font-awesome.css - standard Font Awesome styles
    • jquery-ui.min.css - styles for jQuery UI
  • fonts - Font Awesome fonts
  • includes - folder with additional PHP files
    • functions.php - public functions
    • updater.php - BeRocket Updater for plugins update from BeRocket site
  • js - folder with JavaScript files
    • admin.js - JavaScript for admin panel settings
    • colpick.js - JavaScript for color picker in admin panel settings
  • templates - templates for settings, list style and buttons
    • settings.php - plugin settings page