Sie sind nicht angemeldet.

mham

Anfänger

  • »mham« ist der Autor dieses Themas

Beiträge: 28

Wohnort: Stockholm, Sweden

  • Nachricht senden

1

Dienstag, 8. September 2009, 00:20

Running ktransform on the server ...

Hi again,
I'm a newbee in both krpano and PHP and I'd like to use both, hopefully I can get some help here.

I have loads of images (pnoramas) that are going to be displayed using krpano and I'd like to use the cubical format. Instead of tranforming them from Spherical to Cubical one by one, manually on my computer, I would like to do it automatically at the server side (using PHP).
I've got my PHP upload form set up, when using it the spherical image "inputimage.jpg" goes to "MyImagesFolder" on the server, I have uploaded the ktransform for linux to the server as well and I know that I should somehow run "ktransform cube6 inputimage.jpg outputimage.jpg" but I don't know how to do it in my PHP scripts after the images are loaded to "MyImagesFolder".

Anybody more experienced in PHP that can help?


Thanks,
MH

Shanti

Fortgeschrittener

Beiträge: 301

Wohnort: Puerto Vallarta

Beruf: Web Developer

  • Nachricht senden

2

Dienstag, 8. September 2009, 06:28

I will respond to your email here :)

here is how I do it


Quellcode

1
2
3
4
5
6
7
8
9
10
$path = full/url/to/image.jpg
$preview = str_replace("http://www.yoururl.com/","/full/linux/path/public_html/",$path);
$thisfile = str_replace(".jpg","_b.jpg",$preview);

//we check if the cubes are not already created, if not then, call krtransform
if (!file_exists($thisfile)) {
$output = array();
$return_var = 0;
exec("/home1/path/ktransform cube6 $preview $preview -jpegoptimize", $output, $return_var);
}


the images will be stored on the same place with the same base name as the original.. say image_b.jpg etc etc
also make sure the krtransform is set to be executed and set it on a folder NOT accessible by public
hope I made it clear

Regards

mham

Anfänger

  • »mham« ist der Autor dieses Themas

Beiträge: 28

Wohnort: Stockholm, Sweden

  • Nachricht senden

3

Donnerstag, 10. September 2009, 14:05

Many thanks Shanti,

It should be as clear as it could be, as you have written the whole code.
But of some reason I cannot make it work, as I am not a developer myself, I suppose.
I must have done something wrong, maybe in the different paths.

If I have the following url:
http://www.myPanos.com/
and my panos are in the folder "panoImages" and my pano image is "pano1.jpg", then, In your code sample you have written:
$path = full/url/to/image.jpg
I should write:
$path = http://www.myPanos.com/panoImages/pano1.jpg
Is this correct?

Then on the next line in my code should be
$preview = str_replace("http://www.myPanos.com/","/full/linux/path/public_html/",$path);
except that the "/full/linux/path/public_html/" should be replaced by something else...
as I am just using a web hosting service I am not sure if I can see the full linux path,
all I see is that my index page is in this path "/webspace/httpdocs/",
I cannot see what is above this structure.
I suppose this is a possible reason why it does not work.

Regards,
/M

Ähnliche Themen