Re: How to display JPEG/GIF/PNG images?
| From: | Ivan Rodriguez | Date: | Wed, 19 Mar 2003 19:57:39 +0000 |
| Subject: | Re: How to display JPEG/GIF/PNG images? | ||
| References: | 1 2 3 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-3115@lists.php.net to get a copy of this message | ||
An example:
<?php
dl('php_gtk.so');
if ($argc < 2) die("\nUsage: php gdk_pixbuf.php <imagefile>\n\n");
$image_file = $argv[1];
$window = &new GtkWindow();
$window->set_border_width(5);
$window->set_title('GdkPixbuf example');
$window->set_policy(false, false, true);
$window->connect_object('destroy', array('gtk', 'main_quit'));
$pixbuf = GdkPixbuf::new_from_file($image_file);
if (!$pixbuf) {
die("\nCouldn't load $image_file\n\n");
}
$area = &new GtkDrawingArea();
$area->size($pixbuf->get_width(), $pixbuf->get_height());
$area->connect('expose_event', 'expose_event', $pixbuf);
$frame = &new GtkFrame();
$frame->add($area);
$frame->set_shadow_type(GTK_SHADOW_IN);
$window->add($frame);
$window->show_all();
gtk::main();
function expose_event($area, $event, $pixbuf)
{
$pixbuf->render_to_drawable($area->window,
$area->style->fg_gc[GTK_STATE_NORMAL], $event->area->x, $event->area->y,
$event->area->x, $event->area->y, $event->area->width,
$event->area->height, GDK_RGB_DITHER_NORMAL, 0, 0);
}
?>
El mié, 19-03-2003 a las 20:32, Richard Gabriel escribió:
> I searched the gtk.php.net docs and there is nothing about GdkPixBuf. A
> small example would be very helpful. Or, if anyone could point me to the
> right documentation, that would be great. Thanks.
>
> ----- Original Message -----
> From: "epplestun" <epplestun@alaplaya.com>
> To: "Richard Gabriel" <rgabriel@coresense.com>;
> <php-gtk-general@lists.php.net>
> Sent: Wednesday, March 19, 2003 11:30 AM
> Subject: Re: [PHP-GTK] How to display JPEG/GIF/PNG images?
>
>
> > To show jpeg, png and this types of images you need to use gdkpixbuf, you
> > have more info about this in gtk.php.net
> > ----- Original Message -----
> > From: "Richard Gabriel" <rgabriel@coresense.com>
> > To: <php-gtk-general@lists.php.net>
> > Sent: Wednesday, March 19, 2003 5:25 PM
> > Subject: [PHP-GTK] How to display JPEG/GIF/PNG images?
> >
> >
> > How would I read in a GIF, JPEG, or PNG image from a file or URL and
> display
> > it in my PHP-GTK app? I have compiled the GD lib into PHP and I can
> create
> > image resources from those file types, but how do I convert the image
> > resource to a pixmap and mask for use when creating a GtkPixmap? Or is
> > there another easier way to do it? Thanks!
> >
> >
> >
> > --
> > PHP-GTK General Mailing List (http://gtk.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>