View previous topic :: View next topic |
Author |
Message |
kopf1988 -
Joined: 01 Jun 2003 Posts: 7
|
Posted: Tue Jul 22, 2003 4:34 pm Post subject: How do I open an image with my perl script? |
|
|
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 |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Wed Jul 23, 2003 6:29 pm Post subject: Re: How do I open an image with my perl script? |
|
|
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 |
|
|
kopf1988 -
Joined: 01 Jun 2003 Posts: 7
|
Posted: Fri Jul 25, 2003 11:56 pm Post subject: |
|
|
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 |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Sat Jul 26, 2003 6:36 pm Post subject: |
|
|
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 |
|
|
kopf1988 -
Joined: 01 Jun 2003 Posts: 7
|
Posted: Sun Jul 27, 2003 4:59 am Post subject: Where is this documentation? And... |
|
|
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 |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Sun Jul 27, 2003 6:17 pm Post subject: Re: Where is this documentation? And... |
|
|
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 |
|
|
JohnC -
Joined: 09 Oct 2003 Posts: 34
|
Posted: Thu Oct 09, 2003 5:41 pm Post subject: |
|
|
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 |
|
|
rockslammer_ -
Joined: 19 Sep 2003 Posts: 6 Location: Michigan
|
|
Back to top |
|
|
|