Use Tencent cloud service picture thumbnail

In the business development process, we sometimes encounter such a business scenario - a showcase Atlas / album. When a large image is loaded, on the one hand we want the picture lazy loading; on the other hand, want to show thumbnails in the list, and then show when opening the big picture. Now thanks to the development of cloud services, these requirements are annoying bigwigs made the third-party services, as long as we pay on the line. This article describes the call Tencent cloud image processing services. Prior to look down, first of all please read the official document. https://cloud.tencent.com/document/product/460/6929

The opening of photo processing services

First you should use Tencent object storage service, otherwise it is not the use of photo processing services. It is open picture step process services:

  1. Enter data Vientiane console , if not open, you must first open
  2. Bucket enter [Management] from the left menu bar
  3. If you've used an object store pictures, click Bind bucket
    "Untitled" copy .png
  4. After binding is complete, click on the right-hand bucket Management
  5. After the domain name management into the management can see the "photo processing domain," when you want to generate thumbnails, perform image processing, we need to let go of this domain picture
  6. Query parameter documentation of the picture can be compressed by requesting the domain name +.

Here's an example: Suppose you have a picture on an object storage, the address is:

https://xxxx.254101407.cos.ap-shanghai.myqcloud.com/banner/planet/box.png (2M)

Then you want to get this picture thumbnails, then you need to set the image src is:

# 格式:图片处理域名 + 图片路径 < bucketname >-[APPID].picsh.myqcloud.com

https://xxxx-254101407.picsh.myqcloud.com/banner/planet/box.png?imageView2/1/w/600/h/300

In short, the picture processing services is achieved through the transfer process a query string parameter, meaning query parameters can refer to the official document: https://cloud.tencent.com/document/product/460/6929

Pipe operator "|"

Other photo processing services, such as adding image watermark, text watermark document can refer to the official website, where mention about the pipeline operator. "|" A big role in the shell, photo processing services api also learn from this. This symbol allows us to order multiple service calls, for example, you want to watermark compressed together, or automatically rotate the picture after being compressed, you can use this symbol, here is a demo official website

http://examples-1251000004.picsh.myqcloud.com/sample.jpeg

?imageMogr2/thumbnail/!50p

<b>|<b>

watermark/2/text/5pWw5o2u5LiH6LGh/fill/I0ZGRkZGRg==/fontsize/30/dx/20/dy/20

Guess you like

Origin www.cnblogs.com/imgss/p/11171743.html