#!/usr/bin/perl -w
=comment
This is for customer proofs NOT cam/management proofs
Responds to a request for a customer proof image from the internet.
Reads the requested image from disk and serves it back to the browser.
Used to serve private images that are not on the apache tree in response to a browser request to
fill an image tag eg
=cut
use strict;
use CGI;
#use File::Copy;
#use Tie::File;
#use Fcntl qw( :DEFAULT :flock );
use steves_general_functions;
my $mycgi = new CGI;
my $imagedata = "";
my $load_image = $mycgi->param( "load_image" );
$load_image = &gen_wash_input($load_image, "filename");
my $proof_folder = "/caralan_com/system/proofing/customer_proofs/proofs_out/";
my $imagefile = $proof_folder . $load_image;
#Set mime type for returned binary dump
if( lc(&gen_get_extension_from_path($imagefile)) eq ".gif"){
print "Content-type: image/gif\n\n";
}
if( lc(&gen_get_extension_from_path($imagefile)) eq ".jpg"){
print "Content-type: image/jpeg\n\n";
}
if( lc(&gen_get_extension_from_path($imagefile)) eq ".tif"){
print "Content-type: image/tif\n\n";
}
#Slurp binary image data from diskfile
{
local( $/, *IMAGEFILE ) ;
open( IMAGEFILE, $imagefile );
$imagedata = ;
close IMAGEFILE;
}
#Send binary dump to browser
print $imagedata;