title: Google Cloud Vision save imagen after detect objects
body: <p>I am trying to save a image in my database after detect objects with Google cloud vision. I am using php, framework laravel, this is my code,</p>
  <pre><code>function detect_object($imagen){
          $path = $imagen-&gt;getRealPath();
          $imageAnnotator = new ImageAnnotatorClient(['credentials' =&gt; base_path('credentials.json')]);
  
          $output = imagecreatefromjpeg($path);
          list($width, $height, $type, $attr) = getimagesize($path);
  
          # annotate the image
          $image = file_get_contents($path);
          $response = $imageAnnotator-&gt;objectLocalization($image);
          $objects = $response-&gt;getLocalizedObjectAnnotations();
  
          foreach ($objects as $object) {
              $name = $object-&gt;getName();
              $score = $object-&gt;getScore();
              $vertices = $object-&gt;getBoundingPoly()-&gt;getNormalizedVertices();
              // printf('%s (confidence %f)):' . PHP_EOL, $name, $score);
              // print('normalized bounding polygon vertices: ');
              // foreach ($vertices as $vertex) {
              //     printf(' (%f, %f)', $vertex-&gt;getX(), $vertex-&gt;getY());
              // }
              // print(PHP_EOL);
              $vertices_finales = [];
              foreach ($vertices as $vertex) {
                  array_push($vertices_finales, ($vertex-&gt;getX() * $width));
                  array_push($vertices_finales, ($vertex-&gt;getY() * $height));
              }
              imagepolygon($output, $vertices_finales, (sizeof($vertices_finales) / 2), 0x00ff00);
              imagestring($output, 5, ($vertices_finales[0] + 10), ($vertices_finales[1] + 10), $name, 0x00ff00);
          }
  
          header('Content-Type: image/jpeg');
          imagejpeg($output);
          imagedestroy($output);
          $imageAnnotator-&gt;close();
      }
  
  </code></pre>
  <p>Could you help me?
  Thanks</p>