made image magick required

This commit is contained in:
JT Smith 2005-03-04 16:42:28 +00:00
parent 15fe4edfab
commit a83e8b85c1
6 changed files with 45 additions and 40 deletions

View file

@ -33,6 +33,7 @@
- bugfix [ 1154247 ] Title and menuTitle set to 'untitled' if url is changed
- bugfix [ 1150982 ] Subscribe to forum thread causes error
- bugfix [ 1151216 ] The Latest News is blank on demo.plainblack.com
- Image Magick is now required to run WebGUI.
6.3.0

View file

@ -7,6 +7,11 @@ upgrading from one version to the next, or even between multiple
versions. Be sure to heed the warnings contained herein as they will
save you many hours of grief.
6.4.0
--------------------------------------------------------------------
* Image Magick is no longer optional.
6.3.0
--------------------------------------------------------------------
* In order to upgrade to 6.3.0 or beyond you need to have already

View file

@ -17,19 +17,19 @@ QnD INSTALL INSTRUCTIONS:
LWP
DBI
DBD::mysql
Digest::MD5
HTML::Parser
Time::HiRes
Archive::Tar
Compress::Zlib
IO::Zlib
Digest::MD5
HTML::Parser
SOAP::Lite
Cache::Cache
Time::HiRes
Image::Magick (optional)
Image::Magick
3. Install Apache (preferably with mod_perl) and set up your config.
If you are using Apache 2, see the additional instructions below.
3. Install Apache with mod_perl and set up your config. See Ruling WebGUI
for information specific to Apache 1.3 vs 2.0.
4. Install MySQL.
@ -50,25 +50,8 @@ QnD INSTALL INSTRUCTIONS:
perl testEnvironment.pl
If it returns all "OK" then you're done. The default admin account
info is "Admin" and "123qwe".
If it returns all "OK" then you're done.
##################################################################
# Apache 2/mod_perl 1.99+ Additional Instructions #
##################################################################
9. Browse to your site. You'll be guided through a few quick questions
to setup an admin account.
In order to get WebGUI to run under Apache 2, several files need to
be modified after you have completed all of the steps above.
1. In "sbin/preload.perl", comment out the following mod_perl 1 line:
# use Apache::Registry ();
2. Uncomment the next line:
use ModPerl::Registry ();
3. In "www/index.pl", comment out the following line:
# $webguiRoot = "..";
4. Uncomment the next line, making sure to change this to your own
full path to WebGUI:
$webguiRoot = "/data/WebGUI";

View file

@ -14,16 +14,13 @@ package WebGUI::Storage::Image;
=cut
use Image::Magick;
use strict;
use WebGUI::Id;
use WebGUI::Session;
use WebGUI::Storage;
use WebGUI::Utility;
# do a check to see if they've installed Image::Magick
my $hasImageMagick = 1;
eval " use Image::Magick; "; $hasImageMagick=0 if $@;
our @ISA = qw(WebGUI::Storage);
@ -33,7 +30,7 @@ Package WebGUI::Storage::Image
=head1 DESCRIPTION
Extends WebGUI::Storageto add image manipulation operations.
Extends WebGUI::Storage to add image manipulation operations.
=head1 SYNOPSIS
@ -51,6 +48,29 @@ my $boolean = $self->isImage;
=cut
#-------------------------------------------------------------------
=head2 addFileFromCaptcha ( )
Generates a captcha image (105px x 26px) and returns the filename and challenge string (6 random characters). For more information about captcha, consult the Wikipedia here: http://en.wikipedia.org/wiki/Captcha
=cut
sub addFileFromCaptcha {
my $challenge;
$challenge.= ('A'..'Z')[26*rand] foreach (1..6);
my $filename = "captcha.".WebGUI::Id::generate().".png";
my $image = Image::Magick->new;
$image->Set(size=>'105x26');
$image->ReadImage('xc:white');
$image->Annotate(pointsize=>20, skewY=>5, skewX=>11, gravity=>'center', fill=>'black', antialias=>'true', text=>$challenge);
$image->Swirl(degrees=>10);
$image->AddNoise(noise=>'Multiplicative');
$image->Border(fill=>'black', width=>1, height=>1);
$image->Write($self->getPath($filename));
return ($filename, $challenge);
}
#-------------------------------------------------------------------
@ -76,10 +96,6 @@ sub generateThumbnail {
WebGUI::ErrorHandler::warn("Can't generate a thumbnail when you haven't specified a file.");
return 0;
}
unless ($hasImageMagick) {
WebGUI::ErrorHandler::warn("Can't generate a thumbnail if you don't have Image Magick.");
return 0;
}
unless ($self->isImage($filename)) {
WebGUI::ErrorHandler::warn("Can't generate a thumbnail for something that's not an image.");
return 0;

View file

@ -11,7 +11,6 @@ $|=1;
use strict;
print "\nStarting WebGUI ".$WebGUI::VERSION."\n";
$ENV{GATEWAY_INTERFACE} =~ /^CGI-Perl/ or die "GATEWAY_INTERFACE not Perl!";
#----------------------------------------
# Enable the mod_perl environment.
@ -29,7 +28,7 @@ use CGI (); CGI->compile(':all');
use CGI::Carp ();
use CGI::Util ();
use Digest::MD5 ();
eval "use Image::Magick ();"; # eval, may not be installed
use Image::Magick ();
use File::Copy ();
use File::Path ();
use FileHandle ();

View file

@ -239,11 +239,12 @@ if (eval { require Time::HiRes }) {
}
}
print "Image::Magick module (optional) .......... ";
print "Image::Magick module ..................... ";
if (eval { require Image::Magick }) {
print "OK\n";
} else {
print "Not installed. Thumbnailing will be disabled.\n";
print "Please install.\n";
$prereq = 0;
}
# this is here to insure they installed correctly.