Index: trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
===================================================================
--- trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 25776)
+++ trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 25793)
@@ -128,5 +128,6 @@
 }
 
-sub lookup {
+sub lookup
+{
     my $ipprc    = shift;
     my $image_db = shift;
@@ -296,5 +297,5 @@
 
         # if uri is nil this will get overridded below
-        # (this is for raw stage)
+        # (we do this here for raw stage)
         $out->{image}  = $image->{uri};
         if ($set_class_id) {
@@ -302,8 +303,23 @@
             $out->{component} = $class_id;
         }
+        my $stage_id;
+        if ($img_type eq "raw") {
+            $stage_id = $image->{exp_id};
+        } elsif ($img_type eq "chip") {
+            $stage_id = $image->{chip};
+        } elsif ($img_type eq "warp") {
+            $stage_id = $image->{warp_id};
+        } elsif ($img_type eq "diff") {
+            $stage_id = $image->{diff_id};
+        } elsif ($img_type eq "stack") {
+            $stage_id = $image->{stack_id};
+        }
+        $image->{stage_id} = $stage_id;
+        $image->{stage}    = $img_type;
+        $image->{image_db} = $image_db;
 
         # find the mask and weight images
         if ($base) {
-            $out->{image}  = $ipprc->filename($image_name,   $base, $class_id) if $image_name;
+            $out->{image}  = $ipprc->filename($image_name,  $base, $class_id) if $image_name;
             $out->{mask}   = $ipprc->filename($mask_name,   $base, $class_id) if $mask_name;
             $out->{weight} = $ipprc->filename($weight_name, $base, $class_id) if $weight_name;
