From 7bbe939d139be7edd77378cfc9a2c3ec6287749d Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 14 Oct 2010 01:14:27 +0000 Subject: more contact work and preliminary business card upload --- httemplate/edit/prospect_main-ocr.html | 86 ++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 httemplate/edit/prospect_main-ocr.html (limited to 'httemplate/edit/prospect_main-ocr.html') diff --git a/httemplate/edit/prospect_main-ocr.html b/httemplate/edit/prospect_main-ocr.html new file mode 100644 index 000000000..41fc4c105 --- /dev/null +++ b/httemplate/edit/prospect_main-ocr.html @@ -0,0 +1,86 @@ +<% include("/elements/header.html", 'Upload business card' ) %> + +% if ( $error ) { + Error: <% $error %> +

+% } else { + +
+ + + + +% my $num = 0; +% foreach my $line ( @lines ) { + + + + +% unless ( $num++) { + + + +% } + + +% } + +
+ + + <% $line %>
+ +
+ + +% } +<% include('/elements/footer.html') %> +<%init> + +my $fh = $cgi->upload('card'); + +my $error = ''; +my @lines = (); +my $session = ''; +if ( defined $fh ) { + + local $/; + my $logo_data = <$fh>; + + $session = int(rand(4294967296)); #XXX + my $pref = new FS::access_user_pref({ + 'usernum' => $FS::CurrentUser::CurrentUser->usernum, + 'prefname' => "bizcard$session", + 'prefvalue' => encode_base64($logo_data), + 'expiration' => time + 3600, #1h? 1m? + }); + my $pref_error = $pref->insert; + if ( $pref_error ) { + die "FATAL: couldn't set preview cookie: $pref_error\n"; + } + + @lines = eval { ocr_image($logo_data); }; + $error = $@ if $error; + +} else { + + $error = 'No file uploaded'; + +} + + -- cgit v1.2.1