From 7389128d99fae33228ba6753cd1957e09dadfe63 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Tue, 3 May 2011 17:04:48 -0500 Subject: [PATCH] must have a width/height in order to set width/height Failing to give a proper width/height will cause ImageMagick to die with an assertion error --- lib/WebGUI/Image.pm | 2 ++ lib/WebGUI/Image/Graph.pm | 3 +++ 2 files changed, 5 insertions(+) diff --git a/lib/WebGUI/Image.pm b/lib/WebGUI/Image.pm index a8837f22f..773d6d246 100644 --- a/lib/WebGUI/Image.pm +++ b/lib/WebGUI/Image.pm @@ -250,6 +250,7 @@ The height of the image in pixels. sub setImageHeight { my $self = shift; my $height = shift; + die "Must have a height" unless $height; $self->image->Extent(height => $height); $self->image->Colorize(fill => $self->getBackgroundColor); $self->{_properties}->{height} = $height; @@ -270,6 +271,7 @@ Teh width of the image in pixels. sub setImageWidth { my $self = shift; my $width = shift; + die "Must have a width" unless $width; $self->image->Extent(width => $width); $self->image->Colorize(fill => $self->getBackgroundColor); $self->{_properties}->{width} = $width; diff --git a/lib/WebGUI/Image/Graph.pm b/lib/WebGUI/Image/Graph.pm index d867b0130..9c6194838 100644 --- a/lib/WebGUI/Image/Graph.pm +++ b/lib/WebGUI/Image/Graph.pm @@ -621,6 +621,9 @@ sub setConfiguration { my $self = shift; my $config = shift; + $config->{graph_imageWidth} ||= 300; + $config->{graph_imageHeight} ||= 300; + $self->setPalette(WebGUI::Image::Palette->new($self->session, $config->{graph_paletteId})); $self->setLabelOffset($config->{graph_labelOffset}); $self->setLabelFontSize($config->{graph_labelFontSize});