gnope php gtk gui gnope.org  

Show regular image using Glade-2

 
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners
View previous topic :: View next topic  
Author Message
Bmci



Joined: 21 Sep 2006
Posts: 5

PostPosted: Thu Sep 21, 2006 12:39 am    Post subject: Show regular image using Glade-2 Reply with quote

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 Cool [/code]
Back to top
leon_pegg



Joined: 12 Jun 2006
Posts: 113
Location: hemel / UK

PostPosted: Thu Sep 21, 2006 1:09 am    Post subject: Reply with quote

$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

PostPosted: Thu Sep 21, 2006 1:34 am    Post subject: Reply with quote

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

PostPosted: Thu Sep 21, 2006 2:35 pm    Post subject: Reply with quote

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

PostPosted: Thu Sep 21, 2006 8:47 pm    Post subject: Reply with quote

Cheers for that. After much head-scratching, I've finally managed to get Pear installed. Too many php.inis floating about Twisted Evil
Back to top
leon_pegg



Joined: 12 Jun 2006
Posts: 113
Location: hemel / UK

PostPosted: Fri Sep 22, 2006 1:00 am    Post subject: Reply with quote

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

PostPosted: Fri Sep 22, 2006 5:42 pm    Post subject: Reply with quote

I expect to be on here for quite a while so pleased to meet you Cool

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

PostPosted: Fri Sep 22, 2006 5:47 pm    Post subject: Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Templates enhanced by DigiWiki. Hosting by Tradebit.