Skip to content

Commit ee260c0

Browse files
committed
fix JS qs
1 parent 4af9a17 commit ee260c0

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

articles/cognitive-services/Computer-vision/QuickStarts/javascript-thumb.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,19 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
2121

2222
## Prerequisites
2323

24-
You must have a subscription key for Computer Vision. You can get a free trial key from [Try Cognitive Services](https://azure.microsoft.com/try/cognitive-services/?api=computer-vision). Or, follow the instructions in [Create a Cognitive Services account](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account) to subscribe to Computer Vision and get your key. Then, [create environment variables](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account#configure-an-environment-variable-for-authentication) for the key and service endpoint string, named `COMPUTER_VISION_SUBSCRIPTION_KEY` and `COMPUTER_VISION_ENDPOINT`, respectively.
24+
You must have a subscription key for Computer Vision. You can get a free trial key from [Try Cognitive Services](https://azure.microsoft.com/try/cognitive-services/?api=computer-vision). Or, follow the instructions in [Create a Cognitive Services account](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account) to subscribe to Computer Vision and get your key. Save your subscription key and endpoint URL to a temporary location.
2525

2626
## Create and run the sample
2727

2828
To create and run the sample, do the following steps:
2929

30-
1. Copy the following code into a text editor.
31-
1. Optionally, replace the value of the `value` attribute for the `inputImage` control with the URL of a different image that you want to analyze.
30+
1. Create a file called _get-thumbnail.html_, open it in a text editor, and copy the following code into it.
31+
1. Optionally, replace the value of the `value` attribute of the `inputImage` control with the URL of a different image that you want to analyze.
3232
1. Save the code as a file with an `.html` extension. For example, `get-thumbnail.html`.
3333
1. Open a browser window.
3434
1. In the browser, drag and drop the file into the browser window.
35-
1. When the webpage is displayed in the browser, choose the **Generate thumbnail** button.
35+
1. When the webpage is displayed in the browser, paste your subscription key and endpoint URL into the appropriate input boxes.
36+
1. Finally, select the **Generate thumbnail** button.
3637

3738
```html
3839
<!DOCTYPE html>
@@ -48,9 +49,8 @@ To create and run the sample, do the following steps:
4849
// *** Update or verify the following values. ***
4950
// **********************************************
5051
51-
let subscriptionKey = process.env['COMPUTER_VISION_SUBSCRIPTION_KEY'];
52-
let endpoint = process.env['COMPUTER_VISION_ENDPOINT']
53-
if (!subscriptionKey) { throw new Error('Set your environment variables for your subscription key and endpoint.'); }
52+
var subscriptionKey = document.getElementById("subscriptionKey").value;
53+
var endpoint = document.getElementById("endpointUrl").value;
5454
5555
var uriBase = endpoint + "vision/v2.1/generateThumbnail";
5656
@@ -118,6 +118,13 @@ To create and run the sample, do the following steps:
118118
Enter the URL to an image to use in creating a thumbnail image,
119119
then click the <strong>Generate thumbnail</strong> button.
120120
<br><br>
121+
Subscription key:
122+
<input type="text" name="subscriptionKey" id="subscriptionKey"
123+
value="" />
124+
Endpoint URL:
125+
<input type="text" name="endpointUrl" id="endpointUrl"
126+
value="" />
127+
<br><br>
121128
Image for thumbnail:
122129
<input type="text" name="inputImage" id="inputImage"
123130
value="https://upload.wikimedia.org/wikipedia/commons/thumb/5/56/Shorkie_Poo_Puppy.jpg/1280px-Shorkie_Poo_Puppy.jpg" />

0 commit comments

Comments
 (0)