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
This commit is contained in:
Doug Bell 2011-05-03 17:04:48 -05:00
parent 40805cee48
commit 7389128d99
2 changed files with 5 additions and 0 deletions

View file

@ -250,6 +250,7 @@ The height of the image in pixels.
sub setImageHeight { sub setImageHeight {
my $self = shift; my $self = shift;
my $height = shift; my $height = shift;
die "Must have a height" unless $height;
$self->image->Extent(height => $height); $self->image->Extent(height => $height);
$self->image->Colorize(fill => $self->getBackgroundColor); $self->image->Colorize(fill => $self->getBackgroundColor);
$self->{_properties}->{height} = $height; $self->{_properties}->{height} = $height;
@ -270,6 +271,7 @@ Teh width of the image in pixels.
sub setImageWidth { sub setImageWidth {
my $self = shift; my $self = shift;
my $width = shift; my $width = shift;
die "Must have a width" unless $width;
$self->image->Extent(width => $width); $self->image->Extent(width => $width);
$self->image->Colorize(fill => $self->getBackgroundColor); $self->image->Colorize(fill => $self->getBackgroundColor);
$self->{_properties}->{width} = $width; $self->{_properties}->{width} = $width;

View file

@ -621,6 +621,9 @@ sub setConfiguration {
my $self = shift; my $self = shift;
my $config = shift; my $config = shift;
$config->{graph_imageWidth} ||= 300;
$config->{graph_imageHeight} ||= 300;
$self->setPalette(WebGUI::Image::Palette->new($self->session, $config->{graph_paletteId})); $self->setPalette(WebGUI::Image::Palette->new($self->session, $config->{graph_paletteId}));
$self->setLabelOffset($config->{graph_labelOffset}); $self->setLabelOffset($config->{graph_labelOffset});
$self->setLabelFontSize($config->{graph_labelFontSize}); $self->setLabelFontSize($config->{graph_labelFontSize});