Gossamer Forum
Home : General : Perl Programming :

image/jpeg

Quote Reply
image/jpeg
Have anybody ever got this working?
Code:
#!/usr/bin/perl
$image = "/pic.jpg";
print "Content-type: image/jpeg\n\n";
print "$image";
What am I doing wrong? I just don't see it.

Pasha

------------------
The Flying Cranes, Inc:
http://www.theflyingcranes.com
Perl scripts & Web promotion:
http://find.virtualave.net
Quote Reply
Re: image/jpeg In reply to
i want to menipulate images too... someone told me this would work:

$imagefile = "myfile.gif";
binmode STDOUT;
print "Content-type: image/gif\n\n";
open FILE , $imagefile;
print <FILE>;
close FILE;


------------------
-Keith
-WebMaster@custom-perl.hypermart.net
Quote Reply
Re: image/jpeg In reply to
Hi

Try this:
Code:
open (FILE, "file.gif");
print "Content-type: image/gif\n\n";
print while (<FILE> );
close (FILE);


[This message has been edited by Roger (edited August 09, 1999).]
Quote Reply
Re: image/jpeg In reply to
It works:
Code:
#!/usr/bin/perl
open (FILE, "/home/find/public_html/pic.jpg");
print "Content-type: image/jpeg\n\n";
print while (<FILE> );
close (FILE);
Thanks Roger!


------------------
The Flying Cranes, Inc:
http://www.theflyingcranes.com
Perl scripts & Web promotion:
http://find.virtualave.net
Quote Reply
Re: image/jpeg In reply to
Out of curiousity why are you doing it that way?

I've kicked back images this way for 'hidden' directories, to prevent linking, but in general, if you are returning an HTML page, it's better to allow the browser to fetch the image.

Quote Reply
Re: image/jpeg In reply to
hi,
whatever you are trying to do, can't any user just save the result as GIF and then upload it to his site and use it ?



------------------
The Vagabond strikes
Quote Reply
Re: image/jpeg In reply to
Why not just use referrers? Allow only your pages to pull it from the image directory? They work in most situations. That's the best way to prevent off-site linking.

You could also prevent off site linking by putting your images in a images subtree, and every time you build your pages, change the name of the subtree. It's the same idea the adult image sites have used, move the location of the images.

Quote Reply
Re: image/jpeg In reply to
Yep, they can. But they can't fetch it onto their page from your server, if you add some code to the script above.
Smile

------------------
The Flying Cranes, Inc:
http://www.theflyingcranes.com
Perl scripts & Web promotion:
http://find.virtualave.net
Quote Reply
Re: image/jpeg In reply to
Is there a way to fetch images from the remote machine using this technique?

------------------
The Flying Cranes, Inc:
http://www.theflyingcranes.com
Perl scripts & Web promotion:
http://find.virtualave.net