Plugin Directory

Changeset 1245657


Ignore:
Timestamp:
09/15/2015 06:49:49 AM (11 years ago)
Author:
d363f86b
Message:

Added tiled and centered watermark styles

Location:
bulk-photo-to-product-importer-extension-for-woocommerce/trunk
Files:
2 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • bulk-photo-to-product-importer-extension-for-woocommerce/trunk/assets/js/admin.js

    r1178647 r1245657  
    10601060                    data = 'hide_variations=0&' + data;
    10611061                }
    1062                 if ( $('#tiled-watermark').is(':checked') ) {               
    1063                     data = data.replace('tiled_watermark=0', 'tiled_watermark=1');
    1064                 } else {
    1065                     data = 'tiled_watermark=0&' + data;
    1066                 }
    10671062               
    10681063                that.find('input[type=submit]').after('<div class="ptp-loading">Saving...</div>');
  • bulk-photo-to-product-importer-extension-for-woocommerce/trunk/bptpi.php

    r1240559 r1245657  
    66Author: The Portland Company, Designed by Spencer Hill, Coded by Redeye Adaya
    77Author URI: http://www.theportlandcompany.com
    8 Version: 2.3.19
     8Version: 2.4.0
    99Copyright: 2015 The Portland Company
    1010License: GPL v3
     
    2020     * @var string
    2121     */
    22     public $version = '2.3.19';
     22    public $version = '2.4.0';
    2323
    2424    /**
  • bulk-photo-to-product-importer-extension-for-woocommerce/trunk/classes/ajax.php

    r1235446 r1245657  
    499499        echo json_encode( array(
    500500            'success' => true,
    501             'html' => ptp_dropdown_categories( array( 'name' => 'term_id', 'show_option_none' => 'Select a ' . $bptpi_category_naming_scheme, 'walker' => new Walker_Without_Children() ) )
     501            'html' => ptp_dropdown_categories( array( 'name' => 'term_id', 'show_option_none' => 'Select a category' . $bptpi_category_naming_scheme, 'walker' => new Walker_Without_Children() ) )
    502502        ) );
    503503
  • bulk-photo-to-product-importer-extension-for-woocommerce/trunk/classes/settings.php

    r1178647 r1245657  
    3232        $this->defaults = apply_filters( 'ptp_settings_args', array(
    3333            'interval' => 5,
    34             'hide_variations' => 1
     34            'hide_variations' => 1,
     35            'watermark_style' => 'none'
    3536        ) );
    3637       
  • bulk-photo-to-product-importer-extension-for-woocommerce/trunk/includes/functions.php

    r1178647 r1245657  
    6565    //Edited: 6/13/2014 Adjusted overlay image to stretch regardless of the watermark size
    6666    //Edit Start
    67    
    68     $overlay_gd_image = imagecreatefrompng( $watermark_file_path );
    69     $width = imagesx( $overlay_gd_image );
    70     $height  = imagesy( $overlay_gd_image );
    71     $overlay_width = imagesx( $overlay_gd_image );
     67
     68    $overlay_gd_image = imagecreatefrompng( $watermark_file_path );
     69
     70    $width = imagesx( $overlay_gd_image );
     71    $height  = imagesy( $overlay_gd_image );
     72    $overlay_width = imagesx( $overlay_gd_image );
    7273    $overlay_height = imagesy( $overlay_gd_image );
     74
     75    $overlay_downsampling_ratio = 0.1;
     76
     77    if ($overlay_width > $source_width * $overlay_downsampling_ratio) {
     78        $overlay_width_resampled = $source_width * $overlay_downsampling_ratio; // Overlay image will have 20$ width of the image
     79        $overlay_width_delta = $overlay_width_resampled * 100 / $overlay_width; // Detecting ratio
     80        $overlay_height_resampled = $overlay_height * ($overlay_width_delta / 100); // Maintaining aspect ratio
     81
     82        $overlay_resampled = imagecreatetruecolor($overlay_width_resampled, $overlay_height_resampled);
     83        imagealphablending($overlay_resampled, false);
     84        imagesavealpha($overlay_resampled, true);
     85        imagecopyresampled($overlay_resampled, $overlay_gd_image, 0, 0, 0, 0, $overlay_width_resampled, $overlay_height_resampled, $overlay_width, $overlay_height);
     86       
     87        $overlay_gd_image = $overlay_resampled;
     88
     89        $width = imagesx( $overlay_gd_image );
     90        $height  = imagesy( $overlay_gd_image );
     91        $overlay_width = imagesx( $overlay_gd_image );
     92        $overlay_height = imagesy( $overlay_gd_image );
     93    }
     94
     95
    7396   
    7497    // Gaps in between watermark tiles pixels unit
    75     $distance = 50;
     98    $distance = 100;
    7699   
    77     if($settings['tiled_watermark'] == 1)
     100    if($settings['watermark_style'] == 'tiled')
    78101    {
    79102        $h_count = $source_width / ($overlay_width + $distance);
     
    98121        }
    99122    }
    100     else
     123    else if ($settings['watermark_style'] == 'centered')
    101124    {
    102125        /*
     
    129152        );
    130153        */
     154
     155        $overlay_mid_x = ($source_width / 2.0) - ($width / 2.0);
     156        $overlay_mid_y = ($source_height / 2.0) - ($height / 2.0);
     157
    131158       imagecopyresized (
    132159            $source_gd_image,
    133160            $overlay_gd_image,
     161            $overlay_mid_x,
     162            $overlay_mid_y,
    134163            0,
    135164            0,
    136             0,
    137             0,
    138             $source_width,
    139             $source_height,
     165            $width,
     166            $height,
    140167            $width,
    141168            $height
  • bulk-photo-to-product-importer-extension-for-woocommerce/trunk/index.php

    r1178647 r1245657  
    5050               
    5151                <div class="form-field category">
    52                     <span><?php echo ptp_dropdown_categories( array( 'name' => 'term_id', 'show_option_none' => 'Select a ' . $bptpi_category_naming_scheme, 'walker' => new Walker_Without_Children() ) ); ?></span>
     52                    <span><?php echo ptp_dropdown_categories( array( 'name' => 'term_id', 'show_option_none' => 'Select a category' . $bptpi_category_naming_scheme, 'walker' => new Walker_Without_Children() ) ); ?></span>
    5353                    <span class="add-category  dashicons dashicons-plus-alt"></span>
    5454                    <div class="quick-add-category-con"></div>
  • bulk-photo-to-product-importer-extension-for-woocommerce/trunk/readme.md

    r1240559 r1245657  
    11# Bulk Photo to Product Importer Extension for WooCommerce (Free) #
    2 **Contributors:** d363f86b, s3w47m88, adredz
     2**Contributors:** d363f86b, s3w47m88, adredz, tafhim
    33Repository: http://plugins.svn.wordpress.org/bulk-photo-to-product-importer-extension-for-woocommerce/
    44
  • bulk-photo-to-product-importer-extension-for-woocommerce/trunk/readme.txt

    r1178647 r1245657  
    11=== Bulk Photo to Product Importer Extension for WooCommerce (Free) ===
    2 Contributors: d363f86b, s3w47m88, adredz
     2Contributors: d363f86b, s3w47m88, adredz, tafhim
    33Repository: http://plugins.svn.wordpress.org/bulk-photo-to-product-importer-extension-for-woocommerce/
    44
Note: See TracChangeset for help on using the changeset viewer.