Working with an image from an http request

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Working with an image from an http request

Daniel Kasak
I'm using jpgraph on our webserver to create graphs.
I'm using LWP::Simple to fetch the graph, which is in PNG format.
My get() command:

my $graph_image = get($http_request_string);

$graph_image at this point is a string, with a PNG-looking header.

I basically just want to display the image on-screen. Can I do anything
useful with this in-memory, or do I have to save it to a temporary file
and then load it via:

$widget = Gtk2::Image->new_from_file ($filename)

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [hidden email]
website: http://www.nusconsulting.com.au
_______________________________________________
gtk-perl-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Reply | Threaded
Open this post in threaded view
|

Re: Working with an image from an http request

Grant McLean
On Fri, 2005-06-24 at 11:18 +1000, Daniel Kasak wrote:
> I'm using jpgraph on our webserver to create graphs.
> I'm using LWP::Simple to fetch the graph, which is in PNG format.
> ...
> I basically just want to display the image on-screen. Can I do anything
> useful with this in-memory, or do I have to save it to a temporary file

Something like this should do the trick:

  my $loader = Gtk2::Gdk::PixbufLoader->new;
  $loader->write($png_data);
  $loader->close;
  my $pixbuf = $loader->get_pixbuf;

Regards
Grant

_______________________________________________
gtk-perl-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Reply | Threaded
Open this post in threaded view
|

Re: Working with an image from an http request

Daniel Kasak
Grant McLean wrote:

>Something like this should do the trick:
>
>  my $loader = Gtk2::Gdk::PixbufLoader->new;
>  $loader->write($png_data);
>  $loader->close;
>  my $pixbuf = $loader->get_pixbuf;
>  
>
Thanks :)

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [hidden email]
website: http://www.nusconsulting.com.au
_______________________________________________
gtk-perl-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Reply | Threaded
Open this post in threaded view
|

Re: Working with an image from an http request

ofey aikon
Also documented here...

http://live.gnome.org/GTK2_2dPerl_2fRecipes#head-f684ca9e629855a45a836e171c2108c084253e67

Regards,

Ofey.
_______________________________________________
gtk-perl-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list