Re: Installing GTK2 with JPGRAPH
| From: | Marc Quinton | Date: | Fri, 06 Oct 2006 05:58:40 +0000 |
| Subject: | Re: Installing GTK2 with JPGRAPH | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-7334@lists.php.net to get a copy of this message | ||
On 10/5/06, Devon Yates <devon@windlogics.com> wrote:
Has anyone had any luck using jpgraph from within GTK2? I tried to install it a few months ago, and couldn't get it to work. If you have done so, how did you do it?I think there is problems with current function : $pixbuf = GdkPixbuf::new_from_gd($gif); - this function is not availlable if php is not compiled with "bundled" GD library. - I think there is no other way to fill a pixbuf from a GD ressource. - you can do it with a intermediate file, but, that's not as nice. JpGraph has many output handler, it could be possible to write an handler with GxLib. Here is a sample code : <?php error_reporting(E_ALL); //standard stuff for window creation $wnd = new GtkWindow(); $wnd->connect_simple('destroy', array('Gtk', 'main_quit')); $wnd->set_position(Gtk::WIN_POS_CENTER); # $wnd->set_size_request(200, 200); $btn = new GtkButton('select'); $btn->connect_simple('clicked', 'activate_select'); # $wnd->add($btn); # $case = 'from_local_file'; $case = 'from_dist_file'; switch($case){ case 'from_local_file': $file = '/spare/images/test/Dscf1188.jpg'; $pixbuf = GdkPixbuf::new_from_file($file); break; case 'from_dist_file': $file = 'http://gtk.php.net/gifs/php-gtk.gif'; $gif = imagecreatefromgif($file); # Fatal error: PHP-GTK was not compiled against PHP with bundled GD library in ... image2.php on line 27 $pixbuf = GdkPixbuf::new_from_gd($gif); } $img = new GtkImage(); $img->set_from_pixbuf($pixbuf); $wnd->add($img); $wnd->show_all(); Gtk::main(); ?>