Advertisement

07.21.2008 at 09:46AM PDT, ID: 23582440
[x]
Attachment Details

Problem with Perl - How to get image from sql database wrote to an external file?

Asked by linbayzak in Perl Programming Language

Tags: Perl, Internet Explorer 7, n/a

I've been trying to pull some binary data from a database and output this information into an image file (of any kind viewable in IE) but I'm running into some problems. For starters, I get this error in the STDERR Log: error_handler: Data-conversion resulted in overflow. I get this simply from selecting the image from the database, without even trying to display results. I am trying to display the image using the code attached. The CheckNum displays properly but I do not get an image in my link as I wish to achieve. Any ideas on what I'm doing wrong? Thanks.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
my $DB21 = modules::Db->ConnectCheck21();
  my $sql = "SELECT Img, CheckNum
             FROM Image_View
             WHERE UserID = '$FORM->{StoreNum}'
             AND Acct = '$FORM->{BankAcctNum}'
             AND Routing = '$FORM->{RoutingNum}'
             AND CheckNum = '$FORM->{CheckNum}'
             AND Amt = '$FORM->{Amt}'";
 
  my $rs = $DB21->SelectHash($sql);
 
 
  print<<EOD;
 
  <html>
  <head>
  </head>
  <body>
  <table border=0 width=35%>
  <tr>
    <td><b>Check 21 Image Link</b></td>
  </tr>
EOD
  my $bgcolor;
  my $background;
  my $num = 0;
  foreach(sort{$rs->{$a}->{CheckNum} cmp $rs->{$b}->{CheckNum}}keys(%$rs)){
    $num++;
    if($bgcolor == 1){
      $bgcolor = 0;
    }elsif($bgcolor == 0){
      $bgcolor = 1;
    }
    if ($bgcolor == 1) {
        $background = "lightgrey";
    }else {
        $background = "#FFFFFF";
    }
    open OUTPUT, ">output" . $num . ".png";
    my $newdata = $rs->{$_}->{Img};
    print OUTPUT $newdata;
    close OUTPUT;
    print "<tr><td bgcolor='$background'><a href='output" . $num . ".png' target='_blank'>$rs->{$_}->{CheckNum}</a></td></tr>";
  }
 
 
[+][-]07.21.2008 at 10:39AM PDT, ID: 22052558

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 11:48AM PDT, ID: 22053254

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 11:50AM PDT, ID: 22053268

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 12:03PM PDT, ID: 22053374

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 12:29PM PDT, ID: 22053582

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 12:35PM PDT, ID: 22053628

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 01:25PM PDT, ID: 22054003

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 01:28PM PDT, ID: 22054032

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 01:46PM PDT, ID: 22054204

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 02:04PM PDT, ID: 22054332

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: Perl, Internet Explorer 7, n/a
Sign Up Now!
Solution Provided By: Adam314
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628