Add comment-count image to crossposted entries (missed the file)

        Patch by allen. 

diffs (33 lines):

diff -r b3557872aaba -r 1e10c8cffe6c htdocs/tools/commentcount.bml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/tools/commentcount.bml     Wed Aug 05 07:06:56 2009 +0000
@@ -0,0 +1,29 @@
+<?_code # -*-bml-*-
+{
+    use strict;
+    use vars qw(%GET);
+    use Image::Magick;
+
+    # creates an image that shows the current number of comments on 
+    # the given post.
+
+    my $ditemid = $GET{ditemid};
+    my $uid = $GET{uid};
+
+    # get the value to display
+    my $count = $GET{samplecount} || LJ::Entry->new( $uid, ditemid => $ditemid 
)->reply_count;
+
+    # create an image
+    my $image = Image::Magick->new;
+    $image->Set(pen => 'black');
+    $image->Set(font => 'Generic.ttf');
+    $image->Set(pointsize => 12);
+    $image->Read("label:$count");
+
+    # return the image
+    BML::set_content_type("image/png");
+    BML::noparse();
+
+    return $image->ImageToBlob( magick => "png" );
+}
+_code?>
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to