From a83e8b85c1e5efec6788eaed8e834417b80938b4 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Fri, 4 Mar 2005 16:42:28 +0000 Subject: [PATCH] made image magick required --- docs/changelog/6.x.x.txt | 1 + docs/gotcha.txt | 5 +++++ docs/install.txt | 35 +++++++++-------------------------- lib/WebGUI/Storage/Image.pm | 36 ++++++++++++++++++++++++++---------- sbin/preload.perl | 3 +-- sbin/testEnvironment.pl | 5 +++-- 6 files changed, 45 insertions(+), 40 deletions(-) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 9ea15a6ef..82c7c9fe0 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -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 diff --git a/docs/gotcha.txt b/docs/gotcha.txt index e0a679221..5fe50ecfa 100644 --- a/docs/gotcha.txt +++ b/docs/gotcha.txt @@ -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 diff --git a/docs/install.txt b/docs/install.txt index 7687808be..695c30ebf 100644 --- a/docs/install.txt +++ b/docs/install.txt @@ -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"; diff --git a/lib/WebGUI/Storage/Image.pm b/lib/WebGUI/Storage/Image.pm index fd7f8a4b9..34a3ff2e6 100644 --- a/lib/WebGUI/Storage/Image.pm +++ b/lib/WebGUI/Storage/Image.pm @@ -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; diff --git a/sbin/preload.perl b/sbin/preload.perl index 6149ccc94..25d2424c0 100644 --- a/sbin/preload.perl +++ b/sbin/preload.perl @@ -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 (); diff --git a/sbin/testEnvironment.pl b/sbin/testEnvironment.pl index 0dfdae810..089e5e777 100644 --- a/sbin/testEnvironment.pl +++ b/sbin/testEnvironment.pl @@ -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.