[dw-free] Add comment-count image to crossposted entries
[commit: http://hg.dwscoalition.org/dw-free/rev/1e10c8cffe6c]
http://bugs.dwscoalition.org/show_bug.cgi?id=1035
Add comment-count image to crossposted entries (missed the file)
Patch by
allen.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1035
Add comment-count image to crossposted entries (missed the file)
Patch by
Files modified:
- htdocs/tools/commentcount.bml
--------------------------------------------------------------------------------
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?>
--------------------------------------------------------------------------------
