Folks

I'm using:
Apache/1.3.20 (Win32) mod_perl/1.25_01-dev mod_ssl/2.8.4 OpenSSL/0.9.6a running...

If I run the script (below) in d:/apache/mod_perl/ it works.

If I run it in d:/apache/cgi-bin I get this error:
Read(gradient:#ff0000-#0000ff) Warning 330: Unable to open file (#ff0000-#0000ff) [No 
such file or directory] 

However, if I uncomment lines 17 and 18 and run it in d:/apache/cgi-bin, it works, 
even without lines 20 .. 22.

Note: Removing PATH from line 15 has no effect on this problem.

Note: Setting $ENV{'PATH'} in the code to be exactly the same as it is for any non-CGI 
script has no effect on this problem.

Any ideas?

-----><8-----
#!/usr/bin/perl
#
# Name:
# im-demo.cgi.

use strict;
use warnings;

use CGI qw/nobr/;
use CGI::Carp qw/fatalsToBrowser/;
use Image::Magick;

# --------------------------------------------------------------------------

delete @ENV{'BASH_ENV', 'CDPATH', 'ENV', 'IFS', 'PATH'}; # Zap for safety.

#my($dir_name) = 'd:/ImageMagick/VisualMagick/bin';
#chdir($dir_name) || die("Can't chdir($dir_name): $!");

$ENV{'MAGICK_DELEGATE_PATH'} = 'D:\\ImageMagick\\VisualMagick\\bin';
$ENV{'MAGICK_HOME'}    = 'D:\\ImageMagick\\VisualMagick\\bin';
$ENV{'MAGICK_MODULE_PATH'}  = 'D:\\ImageMagick\\VisualMagick\\bin';

my($output_file_name_a) = 'hax-gradient-1a.png';
my($q)     = CGI -> new();
my($title)    = 'Test';
my($html)    = [];
my($image)    = Image::Magick -> new;
my($result)    = $image -> Set(size => '30x180') || 'OK';
push(@$html, $q -> th('Set') . $q -> td($result) );

$result = $image->Read("gradient:#ff0000-#0000ff") || 'OK';
push(@$html, $q -> th('Read(gradient:#ff0000-#0000ff)') . $q -> td($result) );

$result = $image->Write("png:d:/apache/htdocs/$output_file_name_a") || 'OK';
push(@$html, $q -> th("Write($output_file_name_a)") . $q -> td($result) );
push(@$html, $q -> th('Image') . $q -> td($q -> img({name => 'imagedemo1', src => 
"/$output_file_name_a"})) );

push(@$html, $q -> th('$ENV{MAGICK_DELEGATE_PATH}') . $q -> 
td($ENV{'MAGICK_DELEGATE_PATH'}) );
push(@$html, $q -> th('$ENV{MAGICK_HOME}') . $q -> td($ENV{'MAGICK_HOME'}) );
push(@$html, $q -> th('$ENV{MAGICK_MODULE_PATH}') . $q -> 
td($ENV{'MAGICK_MODULE_PATH'}) );

print $q -> header(),
  $q -> start_html(),
  $q -> center($q -> h1($title) ),
  $q -> table
  (
   {align => 'center', bgColor => '#80c0ff'},
   $q -> Tr($html)
  ),
  $q -> end_html();
-----><8-----

Cheers
Ron Savage
[EMAIL PROTECTED]
http://savage.net.au/index.html

Reply via email to