Changeset 709903
- Timestamp:
- 05/08/2013 02:15:13 PM (13 years ago)
- Location:
- transparent-image-watermark-plugin/trunk
- Files:
-
- 4 edited
-
readme.txt (modified) (2 diffs)
-
transparent-watermark-loader.php (modified) (1 diff)
-
transparent-watermark-plugin.php (modified) (10 diffs)
-
transparent-watermark-tools.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
transparent-image-watermark-plugin/trunk/readme.txt
r708709 r709903 5 5 Requires at least: 3.3 6 6 Tested up to: 3.5.1 7 Stable tag: 2.3. 87 Stable tag: 2.3.9 8 8 Donate link: http://MyWebsiteAdvisor.com/donations/ 9 9 … … 204 204 205 205 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 206 213 = 2.3.8 = 207 214 * fixed text watermark system. -
transparent-image-watermark-plugin/trunk/transparent-watermark-loader.php
r708709 r709903 4 4 Plugin URI: http://MyWebsiteAdvisor.com/tools/wordpress-plugins/transparent-image-watermark/ 5 5 Description: Add transparent PNG image watermark to your uploaded images. 6 Version: 2.3. 86 Version: 2.3.9 7 7 Author: MyWebsiteAdvisor 8 8 Author URI: http://MyWebsiteAdvisor.com -
transparent-image-watermark-plugin/trunk/transparent-watermark-plugin.php
r708709 r709903 6 6 7 7 //plugin version number 8 private $version = "2.3. 8";8 private $version = "2.3.9"; 9 9 10 10 private $debug = false; … … 132 132 $bk_meta = get_post_meta($attachment_id, '_watermark_backups', true); 133 133 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 } 136 138 } 137 139 … … 1111 1113 if ($post->post_mime_type == 'image/jpeg' || $post->post_mime_type == 'image/gif' || $post->post_mime_type == 'image/png') { 1112 1114 1113 //$ajax_url = "../".PLUGINDIR . "/". dirname(plugin_basename (__FILE__))."/watermark_ajax.php"; 1114 $image_url = $post->guid; 1115 1116 1115 1117 1116 $form_js = "<style> 1118 1119 #watermark_preview{ 1117 #watermark_preview { 1120 1118 position:absolute; 1121 1119 border:1px solid #ccc; … … 1125 1123 color:#fff; 1126 1124 } 1127 #watermark_preview img {1125 #watermark_preview img { 1128 1126 max-width:300px; 1129 1127 max-height:300px; … … 1131 1129 } 1132 1130 1133 p#watermark_preview {1131 p#watermark_preview { 1134 1132 z-index:200000; 1135 1133 } … … 1137 1135 </style>"; 1138 1136 1139 1140 1137 /** 1141 1138 1142 1139 $attachment_info = wp_get_attachment_metadata($post->ID); … … 1181 1178 $filepath = ABSPATH . str_replace(get_option('siteurl'), "", $url_base); 1182 1179 $filepath = str_replace("//", "/", $filepath); 1180 **/ 1183 1181 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); 1184 1197 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 1189 1218 1190 1219 $form_fields['image-watermark-header'] = array( … … 1194 1223 1195 1224 1225 $time = file_exists($file_path) ? filemtime($file_path) : rand(10000,500000); 1226 1196 1227 $checked = ""; 1197 1228 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 } 1202 1234 } 1203 1235 } 1204 1236 1205 1237 $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>"; 1207 1239 $form_html .= $form_js; 1208 1240 … … 1213 1245 1214 1246 1215 foreach($sizes as$size){1247 foreach($sizes as $name => $size){ 1216 1248 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); 1221 1252 1222 1253 1223 1254 $checked = ""; 1224 1255 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 } 1228 1261 } 1229 1262 } 1230 1263 1231 1264 $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>"; 1233 1266 1234 1267 $id = 'image-watermark-' . $size['width'] . "x" . $size['height']; … … 1236 1269 1237 1270 $form_fields[ $id ] = array( 1238 'label' => __( $size['width'] . "x" . $size['height'], 'transparent-watermark'),1271 'label' => __(ucwords($name), 'transparent-watermark'), 1239 1272 'input' => 'html', 1240 1273 'html' => $form_html); -
transparent-image-watermark-plugin/trunk/transparent-watermark-tools.php
r708709 r709903 415 415 $key = $path_info['filename']; 416 416 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 419 425 if(!array_key_exists($key, $bk_meta)){ 420 426 … … 422 428 $bk_meta[$key]['original_path'] = $filepath; 423 429 424 error_log("update_post_meta $attachment_id, $backup_file_path");430 425 431 update_post_meta( $attachment_id, '_watermark_backups', $bk_meta); 426 432 … … 438 444 439 445 } 446 440 447 } 441 448
Note: See TracChangeset
for help on using the changeset viewer.