Hi,
I'm a newbie to Gimp. I'm trying to use perl scripts to run gimp. The
scripts run when i execute it form the command line but when i run it from a
browser it doesn't work. the error_log shows:
[Fri Nov 08 12:21:57 2002] [error] [client 127.0.0.1] protocol error (1) at
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Gimp/Net.pm line 66.
I have searched the newsgroups and found that this problem is quite common
but no one has provided a solution. Does any one have any ideas as to how i
can solve this problem?
I have included my script in this mail if it helps.
I look forward to your assistence.
Thanks
Hakeem
#!/usr/bin/perl
#include the modules necessary to interface with gimp
use Gimp qw(:auto);
use Gimp::Fu;
use Gimp::Net;
use CGI;
Gimp::set_trace(TRACE_ALL); # Enable trace output
#tell browser what output format to expect
print Content-type:text/html\n\n;
print HEAD;
htmlheadtitleResults/title/head
body
h2Results/h2
HEAD
print Running as , scalar getpwuid($), \n;
#parse the data posted from the form into thier respcted names
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(//, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(C,hex($1))/eg;
$FORM{$name} = $value;
}
$infile = /var/www/inimg/;
$outfile = /var/www/outimg/;
$infile = $infile . car.gif;
$outfile = $outfile . car_out.gif;
print infile, $infile;
#Register extension to gimp
register(, ,None,*,,\embed);
exit main();
sub embed{
print \ninfile got here, $infile;
$img = gimp_file_load($infile,$infile); $drawable =
gimp_image_flatten($img); # in case of layers
file_png_save($img,$drawable,$outfile,$outfile,0,9,0,0,0,0,0);
print EndHTML;
Here is what you entered:p
Image name: $FORM{'image'}p
Output name: $FORM{'output_img'}p
Alpha value: $FORM{'alpha'}p
K_ey: $FORM{'key'}p
L_ength:$FORM{'length'}p
/body/html
EndHTML
return ();
}
_
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer