#!/usr/bin/perl -w
#
# retrieve-picture.pl : CGI script to add and edit updates
#
# Author: alec@edworthyuk.co.uk
#
# $Id: retrieve-picture.pl,v 1.1 2005/03/12 16:41:32 alec Exp alec $
#

# Set up the Perl enviroment
use lib ("/usr/local/DareToDream");
use strict;
use DBI;
use CGI;
use DareToDream;
use UpdatePictures;

# Create some new objects for CGI and the database.
my $D2D = new DareToDream;
my $query = new CGI;

# Get some CGI parameters
my $picture_id = $query->param("picture_id") || exit;

my $update_picture = new UpdatePictures(user => "viewonly",
					password => "viewonly",
					id => $picture_id);
my $photo_data = $update_picture->{picture};

# Create the HTTP MIME header
if(!defined($ENV{MOD_PERL})) {
    print STDOUT "Content-type: image/jpeg\n\n";
}

# Need to get a Content-disposition header in here

print STDOUT $photo_data;

exit;
