PDA

View Full Version : include php in perl (cgi) script


triphere
04-14-2004, 02:27 AM
I know I shouldn't mix codes. I've read it over and over. I know cgi, I do not know php. I am a functioning web developer without php and I have no desire on earth to learn a new language. However, I do need php's image processing ability because the gd module for cgi sucks (only 8 bit processing) and the php version of the same images is very tolerable. I do not have ImageMagick available, gd is all I have. So my question is:

Does anyone know how to call a php script from within a perl script to doctor an image?

gold_dragon
04-18-2004, 08:53 PM
Originally posted by triphere
I know I shouldn't mix codes. I've read it over and over. I know cgi, I do not know php. I am a functioning web developer without php and I have no desire on earth to learn a new language. However, I do need php's image processing ability because the gd module for cgi sucks (only 8 bit processing) and the php version of the same images is very tolerable. I do not have ImageMagick available, gd is all I have. So my question is:

Does anyone know how to call a php script from within a perl script to doctor an image? Dude, if you use a php script that does images you shouldn't have to. Most will display the image by using the HTML img tag. If not then you need to mod the script to include the header("type: image/image_type"); at the top or where it outputs the drawing.

I am surpised there there isn't a module that does this as well as PHP yet.

skidooer
04-24-2004, 01:17 AM
Originally posted by triphere
because the gd module for cgi sucks (only 8 bit processing)
By CGI, I assume you mean perl? In which case, that is not correct. GD for perl supports higher colour depths. Perhaps you need to upgrade your GD.pm?

Does anyone know how to call a php script from within a perl script to doctor an image?

open PHP, "|/path/to/script.php";
while(<PHP>) { print $_; }
close PHP;


That assumes you have
#!/path/to/php
and it is set +x

php_brian
04-24-2004, 02:58 AM
This is interesting...http://www.zend.com/php5/articles/php5-perl.php

It will be coming out with PHP5 and I do realize this may not even benefit you, but it is somewhat related. :)

gold_dragon
04-24-2004, 02:39 PM
Yeah, I looked the GD module for Perl up and it supports above 2.0. It depends on if his hosting has it installed or if it is a personal machine if he can install it himself. As he said that he couldn't do anything about using the Imaging Module, I think it is the former.

I still think the better why would be to just use the img tag unless he can't use PHP.

You are using Perl with CGI right?