Mobile Development 6 min read

Developing a WeChat Mini‑Program for ID Card Capture: A Personal Technical Walkthrough

A Tencent Cloud UI engineer details how they built a WeChat mini‑program that captures a personal ID card with the device camera, uses WXML, WXSS, and JavaScript, adapts layouts with rpx units, leverages WeUI components, and overlays text masks via cover‑view components before uploading the image for registration.

Tencent Cloud Developer
Tencent Cloud Developer
Tencent Cloud Developer
Developing a WeChat Mini‑Program for ID Card Capture: A Personal Technical Walkthrough

The author, a Tencent Cloud UI engineer, shares a personal case study of building a WeChat mini‑program that captures a personal ID card via the device camera and uploads the data for registration.

Project Overview : The mini‑program records an ID card image using the camera, then uploads the file. The author provides screenshots of the final effect.

1. Account Setup : A developer account is required to create a mini‑program; detailed steps are omitted.

2. Development Language : The mini‑program uses the native framework consisting of WXML (markup), WXSS (style) and JavaScript (logic). The view layer (WXML + WXSS) renders the UI, while the logic layer (App Service) handles page logic, API calls and data requests.

The author notes that WXML corresponds to HTML and WXSS to CSS, making the transition from web development straightforward.

3. Screen Adaptation : Mini‑programs use the unit rpx (responsive pixel). 1 rpx = 0.5 px = 1 physical pixel. The design width is fixed at 750 rpx (equivalent to 20 rem), so 1 rem = 750/20 rpx. Designers are advised to use a 750 rpx wide draft.

4. Style Library : WeUI provides a set of interactive components. The author recommends resetting default styles for elements such as image and button when custom designs are needed.

5. Image Handling : Mini‑programs support both local and network images, but due to the 2 MB package size limit, network images are preferred. The author shows the directory structure for placing images and demonstrates how to reference them via inline styles or the image tag. Local images cannot be used in the preview background; only server‑hosted images work.

6. Media Component – Camera : The main challenge was overlaying text and masks on the camera view. The solution uses the built‑in cover-view and cover-image components, which must be nested only within other cover components. The author provides screenshots of the correct nesting that displays the overlay correctly on devices.

In conclusion, the author reflects on the lessons learned, acknowledges possible better approaches, and invites feedback.

front‑end developmentResponsive DesignWeChat Mini-ProgramwxmlCamera Componentwxss
Tencent Cloud Developer
Written by

Tencent Cloud Developer

Official Tencent Cloud community account that brings together developers, shares practical tech insights, and fosters an influential tech exchange community.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.