How do I open an image with my perl script?

 
Post new topic   Reply to topic    Aprelium Forum Index -> Perl
View previous topic :: View next topic  
Author Message
kopf1988
-


Joined: 01 Jun 2003
Posts: 7

PostPosted: Tue Jul 22, 2003 4:34 pm    Post subject: How do I open an image with my perl script? Reply with quote

I wanna open an image directly through my script, and not send the clients browser after. The print "Location: ....... thing doesn't work right. Is it possible to open the image through the server on which the script rests?
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed Jul 23, 2003 6:29 pm    Post subject: Re: How do I open an image with my perl script? Reply with quote

kopf1988 wrote:
I wanna open an image directly through my script, and not send the clients browser after. The print "Location: ....... thing doesn't work right. Is it possible to open the image through the server on which the script rests?

Try using a Perl code like this if you want to redirect to an image:

Code:
print "Location: /thepath/to/your/image/filename.jpg";
print "";

_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
kopf1988
-


Joined: 01 Jun 2003
Posts: 7

PostPosted: Fri Jul 25, 2003 11:56 pm    Post subject: Reply with quote

That tells the client computer to get it though, is it possible to have the server that the script is on to get the image, then send it to the browser?
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Sat Jul 26, 2003 6:36 pm    Post subject: Reply with quote

kopf1988 wrote:
That tells the client computer to get it though, is it possible to have the server that the script is on to get the image, then send it to the browser?

Do you mean that you want to have the script generate an image? If so, please read the documentation of the GD library. This is its purpose.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
kopf1988
-


Joined: 01 Jun 2003
Posts: 7

PostPosted: Sun Jul 27, 2003 4:59 am    Post subject: Where is this documentation? And... Reply with quote

Umm... I'm trying to explain what I want to do as simply as I can....
I want the script to find the image, store it on the server the script is on, then send it from the server to the browser.

I don't want the script to fing the image then tell the browser where to get it.
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Sun Jul 27, 2003 6:17 pm    Post subject: Re: Where is this documentation? And... Reply with quote

kopf1988 wrote:
Umm... I'm trying to explain what I want to do as simply as I can....
I want the script to find the image, store it on the server the script is on, then send it from the server to the browser.

I don't want the script to fing the image then tell the browser where to get it.

You can do that but you should conform at least to the HTTP protocol philosophy. When using HTTP, the browser asks the server to send an object (image/text/HTML/video/etc...), the server generates it and sends it back to the browser. This is how HTTP works.
So to implement what you want to, you can use a script that sends back the image to the browser after finding it. It can simply send the appropriate CGI headers, then open the image file and output its contents.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
JohnC
-


Joined: 09 Oct 2003
Posts: 34

PostPosted: Thu Oct 09, 2003 5:41 pm    Post subject: Reply with quote

The answer to this question (as I undestand it, since it was very poorly defied) lies within the LWP perl module library.

These thingies allow you to GET a file (ie: an image) from a remote server, and then send it back to a browser connected to the script server.

Look in ActivePerl docs for "LWP::Simple" - or Google for the same thing. There are heaps of scripts that do this - search for "Web Fetching" in Google or on Hotscripts.com

It's easy once you read up on it - just gotta get your head around the concept first... JC

BTW - the LWP library is a standard part of the Perl distribution, it isn't anything "special" so you don't need to install anything to run a Perl script that uses LWP
Back to top View user's profile Send private message
rockslammer_
-


Joined: 19 Sep 2003
Posts: 6
Location: Michigan

PostPosted: Tue Dec 23, 2003 2:50 am    Post subject: A lot of good examples here Reply with quote

http://pleac.sourceforge.net/pleac_perl/t1.html
http://pleac.sourceforge.net/pleac_perl/webautomation.html
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> Perl All times are GMT + 1 Hour
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 phpBB Group