Changeset 177108
- Timestamp:
- 11/26/2009 01:57:15 AM (16 years ago)
- Location:
- wordpress-comment-images/trunk
- Files:
-
- 3 added
- 1 edited
- 1 moved
-
README.txt (modified) (2 diffs)
-
comment-images (added)
-
comment-images/js (added)
-
comment-images/js/comment-images.js (added)
-
comment-images/wp-comment-images.php (moved) (moved from wordpress-comment-images/trunk/wp-comment-images.php) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wordpress-comment-images/trunk/README.txt
r79048 r177108 3 3 Contributors: fitztrev 4 4 Requires at least: 2.6 5 Tested up to: 2. 76 Stable tag: 1. 35 Tested up to: 2.9 6 Stable tag: 1.4 7 7 8 8 Comment Image Embedder is a very simple plugin that, once installed, lets your visitors add an image to their comments. 9 10 == Description == 11 12 Comment Image Embedder is a very simple plugin that, once installed, lets your visitors add an image to their comments. 13 14 It’s rather common for a WordPress user to ask how visitors can embed images in the comments section of their blogs. 15 16 This plugin will add a link just below the comment box that a user can click on. When clicked, a prompt will appear for the user to enter the URL of the image. It will then be added to their comment. 17 18 Trevor Fitzgerald 19 http://trevorfitzgerald.com/ 9 20 10 21 == Installation == … … 15 26 4. Activate via the administration interface 16 27 17 == Importance==28 == Frequently Asked Questions == 18 29 19 It’s rather common for a WordPress user to ask how visitors can embed images in the comments section of their blogs. I’ve been asked it a few times myself, and was never sure how to do it... until now. 30 = How do I fix the image size? = 20 31 21 --Trevor Fitzgerald 32 Using your stylesheet, you can adjust the height and width of the images that are displayed. If, for instance, you want the maximum width to be 200 pixels, you can use the CSS max-width property like so. 22 33 23 http://www.trevorfitzgerald.com/ 34 `.comments img { 35 max-width: 200px; 36 }` 37 38 *Check the comments container id or class for what to use in place of '.comments' -
wordpress-comment-images/trunk/comment-images/wp-comment-images.php
r177098 r177108 2 2 /* 3 3 Plugin Name: Comment Image Embedder 4 Plugin URI: http:// www.trevorfitzgerald.com/projects/wordpress-comment-images/4 Plugin URI: http://trevorfitzgerald.com/wordpress-comment-images/ 5 5 Description: Allows your commenters to post images from external sites in comments with a simple interface. 6 Version: 1. 36 Version: 1.4 7 7 Author: Trevor Fitzgerald 8 Author URI: http:// www.trevorfitzgerald.com/8 Author URI: http://trevorfitzgerald.com/ 9 9 */ 10 10 11 function embed_images_js() {12 echo "<script type='text/javascript'>13 function embed_comment_image() {14 var URL = prompt('Enter the Image URL:');15 if (URL) {16 document.getElementById('comment').value = document.getElementById('comment').value + '[img]' + URL + '[/img]';17 }18 }19 </script>20 ";21 }22 23 24 // Accepts 2 formats:25 // 1.) [img]http://image.gif[/img]26 // 2.) [img=http://image.gif]27 11 function embed_images($content) { 28 12 $content = preg_replace('/\[img=?\]*(.*?)(\[\/img)?\]/e', '"<img src=\"$1\" alt=\"" . basename("$1") . "\" />"', $content); … … 31 15 32 16 function embed_image_instructions($id) { 33 echo "<p>You can add images to your comment by <a href='#' onclick='embed_comment_image(); return false;'>clicking here</a>.</p>";17 echo '<p>You can add images to your comment by <a id="addCommentImage" href="#">clicking here</a>.</p>'; 34 18 return $id; 35 19 } … … 37 21 add_filter('comment_text', 'embed_images'); 38 22 add_action('comment_form', 'embed_image_instructions'); 39 add_action('wp_head', 'embed_images_js'); 23 wp_enqueue_script('comment-images', plugins_url('js/comment-images.js', __FILE__), array('jquery'), '1.4'); 24 40 25 ?>
Note: See TracChangeset
for help on using the changeset viewer.