| View previous topic :: View next topic |
| Author |
Message |
Bmci
Joined: 21 Sep 2006 Posts: 5
|
Posted: Thu Sep 21, 2006 12:39 am Post subject: Show regular image using Glade-2 |
|
|
Hi folks,
Have been trying to simply display a regular (gif/jpg/png) image whilst using Glade & signal_autoconnect_instance.
My set-up is a bit strange. The code can explain better than I can!
Please note, this is just my class that does the meaty stuff. There's another file which calls the class but that isn't causing any issues.
| Code: | <?php
class MyClassName {
public $db;
public $glade;
public function __construct($dbUserObj,$glUserObj) {
$this->db=&$dbUserObj;
$this->glade=&$glUserObj;
$this->glade->signal_autoconnect_instance($this);
}
public function __destruct() {
}
public function GetImage($strImgPath) {
//this function grabs a jpg image from a remote server.
//returns image name
}
public function getData() {
$strImgPath=$this->db->get_var("SELECT strImgThumb FROM tbl_products ORDER BY RAND() LIMIT 1;");
$strImgName=$this->GetImage($strImgPath->strImgThumb);
$logoImg=GtkImage::new_from_file($strImgName);
//imgDisplay is a GtkImage in Glade... have tested in a vbox amonst others - no luck :(
$imgDisplay=$this->glade->get_widget('imgDisplay');
//now I'm stuck...
}
public function quit() {
Gtk::main_quit();
}
}
?> |
I'd much prefer to use Glade for speed so a glade solution would be greatly appreciated.
I'm using Linux - in case you need this info.
Thanks in advance [/code] |
|
| Back to top |
|
 |
leon_pegg
Joined: 12 Jun 2006 Posts: 113 Location: hemel / UK
|
Posted: Thu Sep 21, 2006 1:09 am Post subject: |
|
|
$imgDisplay->set_from_file($filename)
should set the image if the filename is local.
hope this helps |
|
| Back to top |
|
 |
Bmci
Joined: 21 Sep 2006 Posts: 5
|
Posted: Thu Sep 21, 2006 1:34 am Post subject: |
|
|
Indeed it did! Can't believe I missed that function!
Also found another method of doing it in a post from last year.
Thank you very much! |
|
| Back to top |
|
 |
leon_pegg
Joined: 12 Jun 2006 Posts: 113 Location: hemel / UK
|
Posted: Thu Sep 21, 2006 2:35 pm Post subject: |
|
|
| i always keep the dev inspector open it realy helps when looking for a method. |
|
| Back to top |
|
 |
Bmci
Joined: 21 Sep 2006 Posts: 5
|
Posted: Thu Sep 21, 2006 8:47 pm Post subject: |
|
|
Cheers for that. After much head-scratching, I've finally managed to get Pear installed. Too many php.inis floating about  |
|
| Back to top |
|
 |
leon_pegg
Joined: 12 Jun 2006 Posts: 113 Location: hemel / UK
|
Posted: Fri Sep 22, 2006 1:00 am Post subject: |
|
|
| know the felling haveing php-gtk apache and numorus others php installs floating about it gets hard |
|
| Back to top |
|
 |
Bmci
Joined: 21 Sep 2006 Posts: 5
|
Posted: Fri Sep 22, 2006 5:42 pm Post subject: |
|
|
I expect to be on here for quite a while so pleased to meet you
It's a shame that very few people are interested in this therefore less active users and code examples etc.
Once I pick up GTK I'll be sure to post anything that could be of interest. |
|
| Back to top |
|
 |
leon_pegg
Joined: 12 Jun 2006 Posts: 113 Location: hemel / UK
|
Posted: Fri Sep 22, 2006 5:47 pm Post subject: |
|
|
nice to here if you want any segestions on using glade with php-gtk2 just ask i have a nice liltle layout i use for my development.
i also package my apps using php_archive so if i have lots of files i only have to distribute one this also hides the glade files. |
|
| Back to top |
|
 |
|