IB2017 has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks
It is easy to display an image into a Tk widget, for instance, a Label or a Text widget. All examples I have seen refer to image files stored locally. I want to show images available on a server for which I have a URL. Is there an alternative to downloading the file image locally and then show it in Tk? A little bit like a Browser (which I think does not save all images locally to display them).
If there is no alternative than downloading the file locally, I try to to write the image to a temporary file:
use LWP::Simple; use File::Temp; my $tempFile = new File::Temp( UNLINK => 0, SUFFIX => '.jpg' ); #my $tempFile = 'img.jpg'; my $url='https://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Win +d_turbines_in_southern_California_2016.jpg/200px-Wind_turbines_in_sou +thern_California_2016.jpg' getstore($url, $tempFile);
Unfortunately my file is empty, and I do not get any error message! If I write it to an ordinary directory, however, I can download the file fine. Any idea?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Tk show image from web
by Discipulus (Canon) on Nov 16, 2019 at 17:32 UTC | |
by IB2017 (Pilgrim) on Nov 16, 2019 at 17:56 UTC | |
by Anonymous Monk on Nov 17, 2019 at 23:21 UTC | |
by Anonymous Monk on Dec 17, 2019 at 14:00 UTC | |
by Anonymous Monk on Nov 16, 2019 at 23:42 UTC |