It would appear that you have two non-perl-related choices: either change the Apache configuration so you can serve images from somewhere where the user that the CGI application runs as can write to, or change the permissions on the existing images directory so that you can create files there.
A third option would be to continue to write the files to the non server accessible directory as you currently are and instead of referencing the image directly in your <img /> element you use a small program to output directly with the appropriate header - something like:
(This is bare bones for testing purposes you might want to make it a bit more robust for production.) And the use <img src="/cgi-bin/image.pl?image=$tag.jpg" /> in your output HTML.#!/usr/bin/perl -T # use strict; use warnings; use File::Spec; use CGI qw(:standard); my $upload_path = '/tmp/upload'; my $filename = param('image'); if ( $filename =~ /([\w.]+\.jpg)$/ ) { $filename = File::Spec->catfile($upload_path, $1); my $image = do { open IMAGE, $filename or die "Bad image $filename $ +!\n"; binmode IMAGE; select IMAGE; local $/; <IMAGE>; }; binmode STDOUT; print STDOUT header('image/jpeg'),$image; } else { print header('text/plain'),"Bad image name - try again"; }
/J\
In reply to Re: CGI-Perl:: Location for saving the GD output
by gellyfish
in thread CGI-Perl:: Location for saving the GD output
by cool
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |