Linux.com

gnome-web-photo & php

Link to this post 25 Feb 10

Hello,

I have implemented this script:


<?php
shell_exec('gnome-web-photo -t 0 --mode=thumbnail -w 512 -s 256 http://www.google.com /tmp/google.jpg');
?>

If I execute it in the shell it runs perfectly, but if I execute it in a browser I view this error: Cannot open display:

Somebody can help me please?

Thank you so much.

Link to this post 25 Feb 10

Sounds like the application is trying to open the X display. Are you trying to get the image to display for someone logged into the server's console or for someone logged into a web site?

Link to this post 25 Feb 10

It looks like the app won't actually print to the screen the way you've invoked it, so maybe you can get away by setting the DISPLAY environment variable first:

<?php
shell_exec('DISPLAY=0:0 gnome-web-photo -t 0 --mode=thumbnail -w 512 -s 256 http://www.google.com /tmp/google.jpg');
?>

Link to this post 25 Feb 10

Thank you for your quickly response.

I have tried your option but the result is the same error.

Best regards.

Link to this post 25 Feb 10

I did a stack trace on gnome-web-photo.

open("/dev/tty", O_RDWR|O_NONBLOCK|O_LARGEFILE) = 3
close(3) = 0

I'm not sure why, but it really wants to open the terminal.

If your goal is just to generate a thumbnail, have you considered using imagemagick's convert?

Link to this post 25 Feb 10

Thanks,

Do you know some method to make a thumbnail with php and imagemagick?

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board