Plugin Directory

Changeset 709903


Ignore:
Timestamp:
05/08/2013 02:15:13 PM (13 years ago)
Author:
ChrisHurst
Message:

2.3.9

  • fixed issue causing error message when deleting non-watermarked image.
  • fixed ereg_replace depricated message
  • updated the edit media page to display the image size names, rahter than the image dimensions
Location:
transparent-image-watermark-plugin/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • transparent-image-watermark-plugin/trunk/readme.txt

    r708709 r709903  
    55Requires at least: 3.3
    66Tested up to: 3.5.1
    7 Stable tag: 2.3.8
     7Stable tag: 2.3.9
    88Donate link: http://MyWebsiteAdvisor.com/donations/
    99
     
    204204
    205205
     206= 2.3.9 =
     207* fixed issue causing error message when deleting non-watermarked image.
     208* fixed ereg_replace depricated message
     209* updated the edit media page to display the image size names, rahter than the image dimensions
     210
     211
     212
    206213= 2.3.8 =
    207214* fixed text watermark system.
  • transparent-image-watermark-plugin/trunk/transparent-watermark-loader.php

    r708709 r709903  
    44Plugin URI: http://MyWebsiteAdvisor.com/tools/wordpress-plugins/transparent-image-watermark/
    55Description: Add transparent PNG image watermark to your uploaded images.
    6 Version: 2.3.8
     6Version: 2.3.9
    77Author: MyWebsiteAdvisor
    88Author URI: http://MyWebsiteAdvisor.com
  • transparent-image-watermark-plugin/trunk/transparent-watermark-plugin.php

    r708709 r709903  
    66
    77    //plugin version number
    8     private $version = "2.3.8";
     8    private $version = "2.3.9";
    99   
    1010    private $debug = false;
     
    132132        $bk_meta = get_post_meta($attachment_id, '_watermark_backups', true);
    133133       
    134         foreach($bk_meta as $key => $info){
    135             @unlink( $info['bk_path'] );
     134        if(isset($bk_meta) && is_array($bk_meta)){
     135            foreach($bk_meta as $key => $info){
     136                @unlink( $info['bk_path'] );
     137            }
    136138        }
    137139       
     
    11111113            if ($post->post_mime_type == 'image/jpeg' || $post->post_mime_type == 'image/gif' || $post->post_mime_type == 'image/png') {
    11121114                       
    1113                 //$ajax_url = "../".PLUGINDIR . "/". dirname(plugin_basename (__FILE__))."/watermark_ajax.php";     
    1114                 $image_url = $post->guid;                         
    1115                                                  
    1116                                                  
     1115                                             
    11171116                    $form_js = "<style>
    1118                    
    1119                         #watermark_preview{
     1117                        #watermark_preview {
    11201118                            position:absolute;
    11211119                            border:1px solid #ccc;
     
    11251123                            color:#fff;
    11261124                        }
    1127                         #watermark_preview img{
     1125                        #watermark_preview img {
    11281126                            max-width:300px; 
    11291127                            max-height:300px;     
     
    11311129                        }
    11321130                       
    1133                         p#watermark_preview{
     1131                        p#watermark_preview {
    11341132                            z-index:200000;
    11351133                        }   
     
    11371135                    </style>";   
    11381136                                                           
    1139 
    1140                                                  
     1137                      /**   
    11411138                         
    11421139                       $attachment_info =  wp_get_attachment_metadata($post->ID);   
     
    11811178                    $filepath = ABSPATH . str_replace(get_option('siteurl'), "", $url_base);
    11821179                    $filepath = str_replace("//", "/", $filepath);
     1180                  **/
    11831181                 
     1182                 
     1183                 
     1184                        $image_url = $post->guid;             
     1185                                                                   
     1186                       $attachment_info =  wp_get_attachment_metadata($post->ID); 
     1187                       
     1188                        $bk_meta = get_post_meta($post->ID, '_watermark_backups', true);   
     1189                         
     1190                       $sizes = array();                           
     1191                       if(isset($attachment_info) && isset($attachment_info['sizes']) ){                           
     1192                          foreach($attachment_info['sizes'] as $name => $size){
     1193                                $sizes[$name] = $size;
     1194                          }
     1195                       }
     1196                    krsort($sizes);
    11841197                 
    1185                   $watermark_horizontal_location = 50;
    1186                   $watermark_vertical_location = 50;
    1187                   $watermark_image = $this->opt['watermark_settings']['watermark_image_url'];
    1188                   $watermark_width = $this->opt['watermark_settings']['watermark_image_width'];
     1198                 
     1199                    //get the filename with extension (stip url path) for the upload
     1200                    $path_info = pathinfo($image_url);
     1201                    $base_filename = $path_info['basename'];       
     1202 
     1203                   
     1204                    //get uploads sub dir
     1205                    $uploads_subdir = "/" . str_replace($base_filename, "", $attachment_info['file']);
     1206 
     1207                 
     1208                    //basic uloads location info                 
     1209                    $upload_dir   = wp_upload_dir();
     1210                    $base_path = $upload_dir['basedir'];
     1211                    $base_url = $upload_dir['baseurl'];
     1212
     1213                 
     1214                    $file_path = $base_path  . $uploads_subdir . $base_filename;
     1215                    $file_url = $base_url   . $uploads_subdir . $base_filename;
     1216                   
     1217                   
    11891218                 
    11901219                    $form_fields['image-watermark-header']  = array(
     
    11941223                       
    11951224                   
     1225                     $time = file_exists($file_path) ? filemtime($file_path) : rand(10000,500000);
     1226                     
    11961227                    $checked = "";
    11971228                       
    1198                        
    1199                     foreach($bk_meta as $key => $bk){
    1200                         if($bk['original_path'] == $filepath){
    1201                             $checked = 'checked="checked" ';   
     1229                    if(isset($bk_meta) && is_array($bk_meta)){ 
     1230                        foreach($bk_meta as $key => $bk){
     1231                            if($bk['original_path'] == $file_path){
     1232                                $checked = 'checked="checked" ';   
     1233                            }
    12021234                        }
    12031235                    }
    12041236                   
    12051237                $form_html = "<p><input type='checkbox' name='attachment_size[]' value='".$post->guid."' style='width:auto;' ".$checked."  class='attachment_sizes'> Original";
    1206                 $form_html .= " <a class='watermark_preview' href='".$post->guid."?".filemtime($filepath)."' title='$base_filename Preview' target='_blank'>" . $base_filename . "</a></p>";
     1238                $form_html .= " <a class='watermark_preview' href='".$post->guid."?". $time ."' title='$base_filename Preview' target='_blank'>" . $base_filename . "</a></p>";
    12071239                  $form_html .= $form_js;
    12081240                 
     
    12131245                 
    12141246                 
    1215                   foreach($sizes as $size){
     1247                   foreach($sizes as $name => $size){
    12161248             
    1217                         $image_link = $base_path.$size['file'];
    1218                        
    1219                         $filename = $path_info['filename'].".".$path_info['extension'];
    1220                         $current_filepath = str_replace($filename, $size['file'], $filepath);
     1249                        $image_link = $base_url . $uploads_subdir .$size['file'];
     1250                        $current_filepath = $base_path  . $uploads_subdir . $size['file'];
     1251                        $time = file_exists($current_filepath) ? filemtime($current_filepath) : rand(10000,500000);
    12211252                       
    12221253                   
    12231254                        $checked = "";
    12241255                           
    1225                         foreach($bk_meta as $key => $bk){
    1226                             if($bk['original_path'] == $current_filepath){
    1227                                 $checked = 'checked="checked" ';   
     1256                        if( isset($bk_meta) && is_array($bk_meta) ){   
     1257                            foreach($bk_meta as $key => $bk){
     1258                                if($bk['original_path'] == $current_filepath){
     1259                                    $checked = 'checked="checked" ';   
     1260                                }
    12281261                            }
    12291262                        }
    1230                    
     1263                       
    12311264                        $form_html = "<p><input type='checkbox' name='attachment_size[]' value='".$base_path.$size['file']."' style='width:auto;' ".$checked."  class='attachment_sizes'> ".$size['width'] . "x" . $size['height'];
    1232                         $form_html .= " <a class='watermark_preview' title='".$size['file']." Preview'  href='".$image_link."?".filemtime($current_filepath)."' target='_blank'>" . $size['file'] . "</a></p>";
     1265                        $form_html .= " <a class='watermark_preview' title='".$size['file']." Preview'  href='".$image_link."?". $time ."' target='_blank'>" . $size['file'] . "</a></p>";
    12331266                   
    12341267                        $id = 'image-watermark-' . $size['width'] . "x" . $size['height'];
     
    12361269                   
    12371270                         $form_fields[ $id ]  = array(
    1238                         'label'      => __($size['width'] . "x" . $size['height'], 'transparent-watermark'),
     1271                        'label'      => __(ucwords($name), 'transparent-watermark'),
    12391272                        'input'      => 'html',
    12401273                        'html'       => $form_html);
  • transparent-image-watermark-plugin/trunk/transparent-watermark-tools.php

    r708709 r709903  
    415415        $key = $path_info['filename'];
    416416       
    417         $bk_meta = get_post_meta($attachment_id, '_watermark_backups', true);
    418        
     417        if( get_post_meta($attachment_id, '_watermark_backups', true) ){
     418            $bk_meta = get_post_meta($attachment_id, '_watermark_backups', true);
     419        }else{
     420            $bk_meta = array();
     421        }
     422       
     423       
     424
    419425        if(!array_key_exists($key, $bk_meta)){
    420426           
     
    422428            $bk_meta[$key]['original_path']     = $filepath;
    423429       
    424             error_log("update_post_meta $attachment_id, $backup_file_path");
     430       
    425431            update_post_meta( $attachment_id, '_watermark_backups', $bk_meta);
    426432           
     
    438444           
    439445        }
     446       
    440447    }
    441448   
Note: See TracChangeset for help on using the changeset viewer.