[Bio] / Sprout / ERDBTypeImage.pm Repository:
ViewVC logotype

Diff of /Sprout/ERDBTypeImage.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5, Sat Oct 1 10:35:02 2011 UTC revision 1.6, Sun Feb 22 03:28:31 2015 UTC
# Line 23  Line 23 
23      use Tracer;      use Tracer;
24      use ERDB;      use ERDB;
25      use GD;      use GD;
     use FIGRules;  
26      use MIME::Base64;      use MIME::Base64;
27      use ERDBExtras;      use ERDBExtras;
28      use base qw(ERDBType);      use base qw(ERDBType);
# Line 54  Line 53 
53      return $retVal;      return $retVal;
54  }  }
55    
56    =head3 NewSessionID
57    
58        my $id = ERDBTypeImage::NewSessionID();
59    
60    Generate a new session ID for the current user.
61    
62    =cut
63    
64    sub NewSessionID {
65        # Declare the return variable.
66        my $retVal;
67        # Get a digest encoder.
68        Trace("Retrieving digest encoder.") if T(3);
69        my $md5 = Digest::MD5->new();
70        # Add the PID, the IP, and the time stamp. Note that the time stamp is
71        # actually two numbers, and we get them both because we're in list
72        # context.
73        Trace("Assembling pieces.") if T(3);
74        $md5->add($$, $ENV{REMOTE_ADDR}, $ENV{REMOTE_PORT}, gettimeofday());
75        # Hash up all this identifying data.
76        Trace("Producing result.") if T(3);
77        $retVal = $md5->hexdigest();
78        # Return the result.
79        return $retVal;
80    }
81    
82    
83  =head2 Virtual Methods  =head2 Virtual Methods
84    
85  =head3 averageLength  =head3 averageLength
# Line 310  Line 336 
336      my ($self, $value) = @_;      my ($self, $value) = @_;
337      # The incoming value here is a GD graphic image. We need to store it      # The incoming value here is a GD graphic image. We need to store it
338      # to a temporary file.      # to a temporary file.
339      my $sessionID = FIGRules::NewSessionID();      my $sessionID = NewSessionID();
340      my $fileName = FIGRules::NewSessionID() . "image$$.png";      my $fileName = $sessionID . "image$$.png";
341      my $oh = Open(undef, ">$ERDBExtras::temp/$fileName");      my $oh = Open(undef, ">$ERDBExtras::temp/$fileName");
342      print $oh $value->png();      print $oh $value->png();
343      close $oh;      close $oh;

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3