public function fire($job, $data)
 {
     $s3 = \Aws::get('s3');
     $response = $s3->getObject(array('Bucket' => $data['bucket'], 'Key' => $data['key']));
     $imagine = new Imagine();
     $image = $imagine->load((string) $response->get('Body'));
     $size = new Box(100, 100);
     $thumb = $image->thumbnail($size);
     $s3->putObject(array('Bucket' => 'testprocqueue', 'Key' => $data['hash'] . '_100x100.' . $data['ext'], 'Body' => $thumb->get($data['ext']), 'ContentType' => $data['mimetype']));
     // Probaby save these to a database here
 }
    public function fetch_all_disk($conn_asm) {
        global $error;
        global $aws_instance_id;
        global $aws_region;

        $sql = "select path, os_mb ,header_status from v\$asm_disk";
        $state_id = oci_parse($conn_asm, $sql);
        $result = oci_execute($state_id);
        if (AWS == TRUE) {
            $aws = new Aws($aws_instance_id, $aws_region);
        }
        $array_disk = array();
        while ($disk = oci_fetch_array($state_id, OCI_BOTH)) {
            if (AWS == TRUE) {
                $aws_volume_id = $aws->fetch_volume_id_by_disk_path($disk['PATH']);
                $disk['aws_volume_id'] = $aws_volume_id;
            }
            array_push($array_disk, $disk);
        }
        return($array_disk);
    }
 public function test_aws()
 {
     include "AWSSDKforPHP/aws.phar";
     $aws = Aws::factory(array("key" => "AKIAISW6SJ2JLXCKPT6A", "secret" => "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", "region" => Region::OREGON));
     die(pr($aws));
 }
         }
         $error->check();
         sleep(1);
     }
     $result = $drive->add_disk($conn_asm, DEFAULT_DG, $disk_path);
     $error->check();
     break;
 case 'remove_storage':
     $drive = new Drive();
     $result = $drive->delete_disk($conn_asm, DEFAULT_DG, $disk_path);
     $error->check();
     break;
 case 'detach_storage':
     $drive = new Drive();
     if (AWS == TRUE) {
         $aws = new Aws($aws_instance_id, $aws_region);
         $aws_volume_id = $aws->fetch_volume_id_by_disk_path($disk_path);
         $aws->detach_volume($aws_volume_id);
         $timer = 0;
         while ($aws->fetch_volume_status($aws_volume_id) != 'available') {
             $timer += 1;
             if ($timer > 60) {
                 $error->set_msg("Had been waiting for volume status becoming available but timeout.");
             }
             $error->check();
             sleep(1);
         }
         $aws->delete_volume($aws_volume_id);
     }
     $error->check();
     break;