Re: [Gimp-developer] Gimp perl Help

2002-11-09 Thread pcg
On Fri, Nov 08, 2002 at 05:48:35PM +, Hakeem Ogunleye [EMAIL PROTECTED] wrote:
 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:

Have you tried ./scriptname -v? that will most likely tell you that gimp
can't open the display.

Make sure your script has access to a valid DISPLAY (e.g. set
$ENV{DISPLAY} ina BEGIN block), e.g. by running an Xserver (Xvfb works
nicely).

 I have searched the newsgroups and found that this problem is quite common 
 but no one has provided a solution.

Maybe search any gimp mailinglist archives, write a FAQ and thus help
others who will, no doubt, have this problem in the future ;-

-- 
  -==- |
  ==-- _   |
  ---==---(_)__  __   __   Marc Lehmann  +--
  --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED]  |e|
  -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
The choice of a GNU generation   |
 |
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer



[Gimp-developer] Gimp perl Help

2002-11-08 Thread Hakeem Ogunleye

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