diff options
author | matthew <matthew> | 2008-12-11 15:18:40 +0000 |
---|---|---|
committer | matthew <matthew> | 2008-12-11 15:18:40 +0000 |
commit | 9d35b85b7d738c38f5eccc978d2dd3142ca86040 (patch) | |
tree | 404838200e2f0d3c0a6c796433d864458a9b1025 | |
parent | ae3f2414aab79f803a19e8266f50c9c6ba2861da (diff) |
Start of auto-rotation.
-rwxr-xr-x | bin/rotate-photos | 52 | ||||
-rw-r--r-- | conf/packages | 1 | ||||
-rw-r--r-- | web/down.default.html | 35 | ||||
-rwxr-xr-x | web/import.cgi | 4 |
4 files changed, 90 insertions, 2 deletions
diff --git a/bin/rotate-photos b/bin/rotate-photos new file mode 100755 index 000000000..2b4068ceb --- /dev/null +++ b/bin/rotate-photos @@ -0,0 +1,52 @@ +#!/usr/bin/perl -w + +# rotate-photos: +# Manaully fix any already-uploaded photos that are orientated wrongly. +# +# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. +# Email: matthew@mysociety.org. WWW: http://www.mysociety.org +# +# $Id: rotate-photos,v 1.1 2008-12-11 15:18:40 matthew Exp $ + +use strict; +require 5.8.0; + +# Horrible boilerplate to set up appropriate library paths. +use FindBin; +use lib "$FindBin::Bin/../perllib"; +use lib "$FindBin::Bin/../../perllib"; + +use Utils; +use mySociety::Config; +use mySociety::DBHandle qw(dbh select_all); +use mySociety::TempFiles; + +BEGIN { + mySociety::Config::set_file("$FindBin::Bin/../conf/general"); + mySociety::DBHandle::configure( + Name => mySociety::Config::get('BCI_DB_NAME'), + User => mySociety::Config::get('BCI_DB_USER'), + Password => mySociety::Config::get('BCI_DB_PASS'), + Host => mySociety::Config::get('BCI_DB_HOST', undef), + Port => mySociety::Config::get('BCI_DB_PORT', undef) + ); +} + +my $r = select_all("select id, photo from problem where service='iPhone'"); +foreach (@$r) { + my $id = $_->{id}; + my $photo = $_->{photo}; + my ($fh, $filename) = mySociety::TempFiles::named_tempfile('.jpeg'); + print $fh $photo; + close $fh; + my $out = `jhead -autorot $filename`; + if ($out) { + open(FP, $filename) or die $!; + $photo = join('', <FP>); + close FP; + Utils::workaround_pg_bytea("update problem set photo=? where id=?", 1, $photo, $id); + dbh()->commit(); + } + unlink $filename; +} + diff --git a/conf/packages b/conf/packages index 301fc7b79..a98b49235 100644 --- a/conf/packages +++ b/conf/packages @@ -1,3 +1,4 @@ +jhead libcache-memcached-perl libdbd-pg-perl libdbi-perl diff --git a/web/down.default.html b/web/down.default.html new file mode 100644 index 000000000..cd5b170fd --- /dev/null +++ b/web/down.default.html @@ -0,0 +1,35 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en-gb"> + <head> + <title>FixMyStreet</title> + <style type="text/css">@import url("/css/core.css"); @import url("/css/main.css");</style> +<!--[if LT IE 7]> +<style type="text/css">@import url("/css/ie6.css");</style> +<![endif]--> + + <!-- RSS --> + </head> + <body> +<h1 id="header">Fix<span id="my">My</span>Street</h1> + +<div id="wrapper"><div id="content"> + +<p id="expl"><strong>FixMyStreet is currently down for maintenance.</strong> +<br><small>Please come back later.</small></p> + +</div></div> + +<h2 class="v">Navigation</h2> +<ul id="navigation"> +<li>team@fixmystreet.com</a></li> +</ul> + +<a href="http://www.mysociety.org/"><img id="logo" src="/i/mysociety-dark.png" alt="View mySociety.org"><span id="logoie"></span></a> + +<p id="footer">Built by <a href="http://www.mysociety.org/">mySociety</a>, +using some <a href="https://secure.mysociety.org/cvstrac/dir?d=mysociety/bci">clever</a> <a +href="https://secure.mysociety.org/cvstrac/dir?d=mysociety/services/TilMa">code</a>.</p> + + +</body> +</html> diff --git a/web/import.cgi b/web/import.cgi index 4096fde9a..b2fb3d798 100755 --- a/web/import.cgi +++ b/web/import.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: import.cgi,v 1.8 2008-11-12 21:59:43 matthew Exp $ +# $Id: import.cgi,v 1.9 2008-12-11 15:18:44 matthew Exp $ use strict; use Error qw(:try); @@ -60,7 +60,7 @@ sub main { my $photo; if ($fh) { try { - $photo = Page::process_photo($fh); + $photo = Page::process_photo($fh, 1); } catch Error::Simple with { my $e = shift; push @errors, "That photo doesn't appear to have uploaded correctly ($e), please try again."; |