2010-09-25 5 views
1

J'ai le code suivant PHP GTK situé dans C:\gtkchemin court GTK PHP

<?php 
if (!class_exists('gtk')) { 
    die("Please load the php-gtk2 module in your php.ini\r\n"); 
} 

$wnd = new GtkWindow(); 
$wnd->set_title('Background'); 
$wnd->set_resizable(false); 
$wnd->set_position(GTK_WIN_POS_CENTER); 

$wnd->connect_simple('destroy', array('gtk', 'main_quit')); 

$im = GtkImage::new_from_file("C:\gtk\bg.jpg"); 
$wnd->add($im); 

$wnd->show_all(); 
Gtk::main(); 
?> 

Il montre l'imageC:\gtk\bg.jpg mais ma question est comment puis-je l'afficher à partir d'un chemin d'accès local. Le fichier PHP se trouve dans ce dossier donc je ne doivent taper bg.jpg mais qui ne fonctionne pas.

Répondre

1

Utilisez

$im = GtkImage::new_from_file(dirname(__FILE__)."\bg.jpg");