title: Inserting an Image in google cloud storage using php api
body: <p>I am trying to setup storage in google cloud platform. Honestly now i am kind of confused on what to do.</p>
  
  <p>I am using the following code.</p>
  
  <pre><code>require_once("vendor/autoload.php");
  
  use Google\Cloud\Storage\StorageClient;
  
  use Google\Cloud\Storage\StorageObject;
  
  use Google\Cloud\Storage;
  
  $projectId = 'YOUR_PROJECT_ID';
  
  $storage = new StorageClient([
       'projectId' =&gt; 'xx',
      'key'=&gt; 'yy'
  ]);
  
  $file_name = "imagename";
  
  $obj = new StorageObject();
  
  $obj-&gt;setName($file_name);
  
  
    $storage-&gt;objects-&gt;insert(
          "kmapsimage",
          $obj,
          ['name' =&gt; $file_name, 'data' =&gt; file_get_contents("https://kmapst.blob.core.windows.net/images/kmap581b939a7a28c.jpeg"),'mimeType' =&gt; 'image/jpeg']
  );
  </code></pre>
  
  <p>On executing the function i get the following error.</p>
  
  <pre><code>Argument 1 passed to Google\Cloud\Storage\StorageObject::__construct() must implement interface Google\Cloud\Storage\Connection\ConnectionInterface, none given, called in /var/www/html/test_imageupload.php on line 35 and defined in /var/www/html/vendor/google/cloud/src/Storage/StorageObject.php on line 71
  </code></pre>
  
  <p>I just want to upload images to google storage.</p>