segmentfault的图片URL缩短是如何实现的?

WBOY
Release: 2016-06-06 20:20:28
Original
1334 people have browsed it

segmentfault的图片URL缩短是如何实现的?

segmentfault的图片URL缩短是如何实现的?

如上图中的,URL地址变短了。实际是用的upyun的CDN地址

求解,谢谢!

回复内容:

segmentfault的图片URL缩短是如何实现的?

segmentfault的图片URL缩短是如何实现的?

如上图中的,URL地址变短了。实际是用的upyun的CDN地址

求解,谢谢!

复制到浏览器里看一下。确实是upyun的。
我猜是把upyun的网址生成的短URL
然后访问的时候直接输出

不难理解,想必短网址你用过,

这个就是上传图片→segmentfault上传到又拍云→数据库加入记录[图片的又拍云文件名,随机生成一个不重复的slug]→ajax返回。

当访问这个URL时segment查询图片对应地址并302跳转

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!