Creating a Function
- Download the image compression program package. For details, see Compressing Images Using a Function.
- Create a function. (Specify an agency with OBS access permissions so that FunctionGraph can invoke the OBS service.)
- Log in to the FunctionGraph console, and choose Functions > Function List in the navigation pane.
- Click Create Function.
- Set the function information and click Create Function. For details, see Creating a Function.
- Click the created function.
- On the Code tab, choose Upload > Local ZIP, upload the program package.
- Choose Configuration > Environment Variables, set environment variables, and click Save.
Table 1 Parameter description Parameter
Description
obs_endpoint
The bucket address parameter defined in index.py. Set the value to obs.region.myhuaweicloud.com.
output_bucket
The output bucket parameter defined in index.py. Set the value to your-bucket-output, the bucket created in Creating OBS Buckets.
- Add a dependency.
The sample code depends on the Pillow package, which needs to be imported as a dependency. The procedure is as follows:
- Go to the details page of the created function, click the Code tab, and click Add in the Dependencies area at the bottom.
- Add the public dependency pillow-7.1.2. The default version is 1. Click OK.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot