info(date('Y-m-d H:i:s') . ' : ' . date('Y-m-d') . ' START'); $googleVisionAuthentication = base_path().'/resources/data/google-vision-authentication.json'; putenv('GOOGLE_APPLICATION_CREDENTIALS='.$googleVisionAuthentication); $imageAnnotator = new ImageAnnotatorClient(); $fileName = 'https://image.rezervasyon.com/hotel/301356/lavin-otel-10-9566879.jpg'; $fileName = 'https://image.rezervasyon.com/hotel/301356/lavin-otel-10-9566886.jpg'; $fileName = 'https://image.rezervasyon.com/hotel/301356/lavin-otel-10-9566881.jpg'; $fileName = 'https://image.rezervasyon.com/hotel/301356/lavin-otel-10-9566878.jpg'; $image = file_get_contents($fileName); $response = $imageAnnotator->labelDetection($image); $labels = $response->getLabelAnnotations(); $labelList = []; if ($labels) { foreach ($labels as $label) { $labelList[] = [ 'description' => $label->getDescription(), 'score' => $label->getScore(), 'topicality' => $label->getTopicality(), ]; } } else { echo('No label found' . PHP_EOL); } $imageAnnotator->close(); print_r($labelList); $this->info(date('Y-m-d H:i:s') . ' : ' . date('Y-m-d') . ' FINISHED'); } catch (Exception $e) { $message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage(); Log::error($message); $this->error(date('Y-m-d H:i:s') . ' : ' . date('Y-m-d') . ' ERROR: ' . $message); } } }