aboutsummaryrefslogtreecommitdiffstats
path: root/web/photo.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'web/photo.cgi')
-rwxr-xr-xweb/photo.cgi54
1 files changed, 0 insertions, 54 deletions
diff --git a/web/photo.cgi b/web/photo.cgi
deleted file mode 100755
index bd38e3bf1..000000000
--- a/web/photo.cgi
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/perl -w -I../perllib
-
-# photo.cgi:
-# Display a photo for FixMyStreet
-#
-# Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved.
-# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
-#
-# $Id: photo.cgi,v 1.11 2008-10-09 14:20:54 matthew Exp $
-
-use strict;
-use Standard;
-use Error qw(:try);
-use CGI::Carp;
-
-sub main {
- my $q = shift;
- print $q->header(-type => 'image/jpeg',
- -expires => '+1y' );
- my $id = $q->param('id');
- my $c = $q->param('c');
- return unless ($id || $c);
- my $photo;
- if ($c) {
- $photo = dbh()->selectrow_arrayref("select photo from comment where
- id=? and state = 'confirmed' and photo is not null", {}, $c);
- } else {
- $photo = dbh()->selectrow_arrayref( "select photo from problem where
- id=? and state in ('confirmed', 'fixed', 'partial') and photo is not
- null", {}, $id);
- }
- return unless $photo;
- $photo = $photo->[0];
- if ($q->param('tn')) {
- $photo = resize($photo, 'x100');
- } elsif ($q->{site} eq 'emptyhomes') {
- $photo = resize($photo, '195x');
- }
-
- print $photo;
-}
-Page::do_fastcgi(\&main, 0, 1);
-
-sub resize {
- my ($photo, $size) = @_;
- use Image::Magick;
- my $image = Image::Magick->new;
- $image->BlobToImage($photo);
- my $err = $image->Scale(geometry => "$size>");
- throw Error::Simple("resize failed: $err") if "$err";
- my @blobs = $image->ImageToBlob();
- undef $image;
- return $blobs[0];
-}