Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. Tạo campaign
- - Lưu JSON + HTML content
- - Tạo một unique key dạng UUID cho mỗi campaign, ví dụ: 8cb39c20-3ad5-47e3-8ca5-e90c58bf19c3
- 2. Tạo link preview campaign
- Link này sẽ view nội dung HTML của campaign như một website hoàn chỉnh
- https://api.gobysend.com/campaign/preview/8cb39c20-3ad5-47e3-8ca5-e90c58bf19c3
- (Mục đích là link này không dò ra được bởi người khác. Trong trường hợp campaign chưa publish mà người khác dò được link có thể bị lộ mất chiến dịch chuẩn bị quảng bá)
- 3. Khi lưu campaign thì gọi service thum.io để sinh thumbnail
- https://image.thum.io/get/auth/10919-e49d55e4-5c58-4f31-a3bd-463a89e62619/https://api.gobysend.com/campaign/preview/8cb39c20-3ad5-47e3-8ca5-e90c58bf19c3
- - Tải thumbnail về thành base64
- $imageContent = bas64_encode(....);
- - Sử dụng Laravel để upload lên Goby's CDN
- $pathToThumb = 'campaigns/' . $accountId . '/thumbnails/' . $campaign->uuid . '.jpg';
- Storage::disk('publicB2')->put($pathToThumb, $imageContent);
- - Lưu thumb URL vào bảng cp_campaigns
- $campaign->thumbnail = config('filesystems.cdnLinks.publicB2') . $pathToThumb;
- $campaign->save();
- 4. Ở client muốn preview thì chỉ việc view link:
- $url = $campaign->thumbnail;
Add Comment
Please, Sign In to add comment