Skip to content

Commit f49b659

Browse files
sirtorrybshaffer
authored andcommitted
Vision PDF/OCR (GoogleCloudPlatform#622)
1 parent 424469e commit f49b659

28 files changed

+429
-289
lines changed

vision/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Vision API from PHP.
3939
text Detect text in an image using Google Cloud Vision API
4040
crop-hints Detect crop hints in an image using Google Cloud Vision API
4141
document-text Detect document text in an image using Google Cloud Vision API
42+
pdf Detect text in a PDF/TIFF using Google Cloud Vision API
4243
web Detect web entities in an image using Google Cloud Vision API
4344
web-geo Detect web entities in an image with geo metadata using
4445
Google Cloud Vision API

vision/composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "google/vision",
33
"type": "project",
44
"require": {
5-
"google/cloud-vision": "^0.10",
5+
"google/cloud-vision": "^0.13",
66
"google/cloud-storage": "^1.3",
77
"symfony/console": "^3.1"
88
},
@@ -32,7 +32,8 @@
3232
"src/detect_web.php",
3333
"src/detect_web_gcs.php",
3434
"src/detect_web_with_geo_metadata.php",
35-
"src/detect_web_with_geo_metadata_gcs.php"
35+
"src/detect_web_with_geo_metadata_gcs.php",
36+
"src/detect_pdf_gcs.php"
3637
]
3738
},
3839
"require-dev": {

vision/composer.lock

Lines changed: 233 additions & 276 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vision/src/detect_crop_hints.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,7 @@ function detect_crop_hints($path)
4747
} else {
4848
print('No crop hints' . PHP_EOL);
4949
}
50+
51+
$imageAnnotator->close();
5052
}
5153
// [END vision_crop_hint_detection]

vision/src/detect_crop_hints_gcs.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,7 @@ function detect_crop_hints_gcs($path)
4646
} else {
4747
print('No crop hints' . PHP_EOL);
4848
}
49+
50+
$imageAnnotator->close();
4951
}
5052
// [END vision_crop_hint_detection_gcs]

vision/src/detect_document_text.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,7 @@ function detect_document_text($path)
6363
} else {
6464
print('No text found' . PHP_EOL);
6565
}
66+
67+
$imageAnnotator->close();
6668
}
6769
// [END vision_fulltext_detection]

vision/src/detect_document_text_gcs.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,7 @@ function detect_document_text_gcs($path)
6363
} else {
6464
print('No text found' . PHP_EOL);
6565
}
66+
67+
$imageAnnotator->close();
6668
}
6769
// [END vision_fulltext_detection_gcs]

vision/src/detect_face.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ function detect_face($path, $outFile = null)
103103
printf('Output image written to %s' . PHP_EOL, $outFile);
104104
# [END vision_face_detection_tutorial_run_application]
105105
}
106+
107+
$imageAnnotator->close();
106108
// [START vision_face_detection]
107109
}
108110
// [END vision_face_detection]

vision/src/detect_face_gcs.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,7 @@ function detect_face_gcs($path)
5454
print('Bounds: ' . join(', ',$bounds) . PHP_EOL);
5555
print(PHP_EOL);
5656
}
57+
58+
$imageAnnotator->close();
5759
}
5860
// [END vision_face_detection_gcs]

vision/src/detect_image_property.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,7 @@ function detect_image_property($path)
4040
printf("Blue: %s" . PHP_EOL, $color->getBlue());
4141
print(PHP_EOL);
4242
}
43+
44+
$imageAnnotator->close();
4345
}
4446
// [END vision_image_property_detection]

0 commit comments

Comments
 (0)