01 May 2013 - After the site upgrade, all passwords were reset and you will need to ask the site for a login reset on your first connection.
This example shows how to use the GtkImage
widget to display an image file in a window.
<?php
error_reporting(E_ALL);
/**
* Replace 'php-gtk.gif' by the name of a file
* in the same directory as the script
*/
$file = 'php-gtk.gif';
// standard stuff for window creation
$wnd = new GtkWindow();
$wnd->connect_simple('destroy', array('Gtk', 'main_quit'));
$wnd->set_position(Gtk::WIN_POS_CENTER);
/**
* You can use either the simple
* or advanced methods below
* to load the file, but not both
*/
# simple usage: you can load the image directly
# $img = GtkImage::new_from_file($file);
# more advanced usage: use a pixbuf
$pixbuf = GdkPixbuf::new_from_file($file);
$img = new GtkImage();
$img->set_from_pixbuf($pixbuf);
# add the image to the window and we're done
$wnd->add($img);
$wnd->show_all();
Gtk::main();
?>In the simple case of a local file, there was not much interest
in loading the file using the GdkPixbuf methods,
because the file would alway be available. However, with remote
files, we must import the files using the GdkPixbuf
so we can ultimately check for errors in the load process.
Note that such remote loading needs GD, so we check for it immediately.
<?php
error_reporting(E_ALL);
/**
* Replace 'php-gtk.gif' by the name of a file
* in the same directory as the script
*/
$file = 'http://gtk.php.net/gifs/php-gtk.gif';
if (!function_exists("gd_info"))
die('This code needs the GD extension to load remote GIFs');
// standard stuff for window creation
$wnd = new GtkWindow();
$wnd->connect_simple('destroy', array('Gtk', 'main_quit'));
$wnd->set_position(Gtk::WIN_POS_CENTER);
/**
* You can use either the simple
* or advanced methods below
* to load the file, but not both
*/
$gif = imagecreatefromgif($file);
$pixbuf = GdkPixbuf::new_from_gd($gif);
$img = new GtkImage();
$img->set_from_pixbuf($pixbuf);
# add the image to the window and we're done
$wnd->add($img);
$wnd->show_all();
Gtk::main();
?>
Neueste Kommentare
vor 43 Wochen 3 Tage
vor 44 Wochen 2 Tage
vor 44 Wochen 6 Tage
vor 47 Wochen 2 Tage
vor 1 Jahr 15 Wochen
vor 1 Jahr 19 Wochen
vor 1 Jahr 23 Wochen
vor 1 Jahr 23 Wochen
vor 1 Jahr 23 Wochen
vor 1 Jahr 40 Wochen