|
|
Anyone who could lend a hand with this, your help is greatly appreciated in
advance.
I'm working on a website that will dynamically create a .pov file based on
user input, and then execute povray on it and return the image to the user.
The following code is a simplified version of the idea.
If I run this code by typing
php test.php
it works fine, but if I put it in a web directory, and then try to execute
by typing
localhost/test.php
as my browser address, the code creates the .pov file, but never executes
the povray command. I read in another post that maybe you have to compile
the povray source code using the directive --without-x to force it not to
use X, but I tried this and it still does not work. Can anybody get this
to work on their webserver? Is it a povray problem, or maybe something
with the way I have Apache configured?
Thanks,
Brad
<?
// test.php
$pov_file_pointer = fopen("test.pov", "w");
if (!$pov_file_pointer) die ('Unable to create POV file.');
fwrite($pov_file_pointer,"#include "colors.inc"n");
fwrite($pov_file_pointer,"background { color Black }n");
fwrite($pov_file_pointer,"global_settings { assumed_gamma 2.2 }nn");
fwrite($pov_file_pointer,"camera {n");
fwrite($pov_file_pointer,"tlocation < 0.0, 0.0, 30.0 >n");
fwrite($pov_file_pointer,"tlook_at < 0.0, 0.0, 0.0 >");
fwrite($pov_file_pointer,"}n");
fwrite ($pov_file_pointer,"cylinder n");
fwrite ($pov_file_pointer,"{n");
fwrite ($pov_file_pointer,"t<30.0 ,30.0, 0.0> n");
fwrite ($pov_file_pointer,"t<-30.0, 30.0, 0.0> n");
fwrite ($pov_file_pointer,"t100.0 n");
fwrite ($pov_file_pointer,"topen n");
fwrite ($pov_file_pointer,"tfinish { n");
fwrite ($pov_file_pointer,"ttambient 1.0n");
fwrite ($pov_file_pointer,"ttdiffuse 0.8n");
fwrite ($pov_file_pointer,"ttphong 1n");
fwrite ($pov_file_pointer,"t}n");
fwrite ($pov_file_pointer,"tpigment { color red 0 green 0 blue 1 }n");
fwrite ($pov_file_pointer,"}n");
fclose($pov_file_pointer);
exec ('povray test.pov -Otest.png -GAtest.out');
?>
Post a reply to this message
|
|