You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cognitive-services/Computer-vision/QuickStarts/javascript-thumb.md
+14-7Lines changed: 14 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,18 +21,19 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
21
21
22
22
## Prerequisites
23
23
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.
25
25
26
26
## Create and run the sample
27
27
28
28
To create and run the sample, do the following steps:
29
29
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.
32
32
1. Save the code as a file with an `.html` extension. For example, `get-thumbnail.html`.
33
33
1. Open a browser window.
34
34
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.
36
37
37
38
```html
38
39
<!DOCTYPE html>
@@ -48,9 +49,8 @@ To create and run the sample, do the following steps:
48
49
// *** Update or verify the following values. ***
49
50
// **********************************************
50
51
51
-
let subscriptionKey =process.env['COMPUTER_VISION_SUBSCRIPTION_KEY'];
52
-
let endpoint =process.env['COMPUTER_VISION_ENDPOINT']
53
-
if (!subscriptionKey) { thrownewError('Set your environment variables for your subscription key and endpoint.'); }
52
+
var subscriptionKey =document.getElementById("subscriptionKey").value;
53
+
var endpoint =document.getElementById("endpointUrl").value;
54
54
55
55
var uriBase = endpoint +"vision/v2.1/generateThumbnail";
56
56
@@ -118,6 +118,13 @@ To create and run the sample, do the following steps:
118
118
Enter the URL to an image to use in creating a thumbnail image,
119
119
then click the <strong>Generate thumbnail</strong> button.
0 commit comments