Picture
一个图片展示网站,由以下几部分组成:
- 存储
- API
- 采集
- 展示
- [X] 完成了web.py框架及api代码框架的搭建
- [X] 完成了pic/file的增删查接口
- [X] 完成了pic/info的增删查接口,并解决了编码问题
- [X] 完成图片抓取功能 http://www.tupian.fm/
- [X] 完成图片信息提取功能
- [X] 完成图片上报
- [X] 完成首页图片列表展示
- [X] 完成了瀑布流显示功能
- [X] 完成了无限滚动功能
- [X] 回顾整理完成的代码
- [X] 增加header/footer
- [X] 增加分类浏览模式支持
- [X] 增加单图浏览模式
- [X] 整理文件代码,本地没有问题。可正常运行。tag1.0
- [X] 上线完毕,代码做了些修正。最重要的是,对图片启用了cache机制。 可以节省带宽流量。明天再整理代码吧!
- [X] 去掉无用的菜单项
- [X] 增加单个图片浏览页
- [X] 支持单张图片浏览页中,显示同系列所有图片
- [X] 整理本地代码,在本地跑起来并上报,上传图片采用数据库导出的方 式来做,节省流量
- [ ] 支持系列图片查看模式
- [ ] 增加放大后的分享、下载链接
- [ ] 增加分类和随机查看
- [ ] 增加click放大/缩小功能(注意:调用layout前先将container的宽度 改为auto)
- [ ] 支持”顶”操作和热门分类
- [ ] 增加缩略图,以加快列表页加载速度
- [ ] 增加app认证逻辑
- [ ] 增加回到页头按钮
- [ ] 可抓取内容
- 将webpy目录拷贝为sinaapp源码的数字目录
- 修改const.py配置,将using_sae=False注释掉
- 提交代码
- 上传图片数据
- 文件: POST /pic/file/new
- 信息: POST /pic/[info|exif]/<picid>
#+EXAMPLE_BEGIN POST /pic/file/new X_APP: key,passwd
<picture data>
HTTP/1.1 200 OK X_PICID: <picid>
#+EXAMPLE_END #+EXAMPLE_BEGIN POST /pic/info/<picid> X_APP: key,passwd
{height: 123; width: 456; …}
HTTP/1.1 200 OK X_PICID: <picid>
#+EXAMPLE_END
- 获取单个文件或信息: GET /pic/file/<picid>.png /pic/[info|exif]/<picid> …
- 获取信息列表: GET /pic/info/list/<offset>/<number> /pic/[info|exif]/list/<picid>/<picid>…
- 图片文件: /pic/file/<picid>.png
- 基本信息: /pic/info/<picid>
- Exif信息: /pic/exif/<picid>
#+EXAMPLE_BEGIN DELETE /pic/file/<picid>.png X_APP: key,passwd
HTTP/1.1 200 OK X_PICID: <picid>
#+EXAMPLE_END
HTTP Method 与 CURD 数据处理操作对应
HTTP方法
数据处理
说明
POST
Create
新增一个没有id的资源
GET
Read
取得一个资源
PUT
Update
更新一个资源。或新增一个含 id 资源(如果 id 不存在)
DELETE
Delete
删除一个资源
RESTFUL WEB SERVICE
RESTful Web Service (又称 RESTful Web API) 是一个使用 HTTP 并符合 REST 原则的 Web 服务。我们知道,通过 URL 可以传送 GET 请求,在 表单指定 method=”GET|POST” 来送出请求。但我们要处理 PUT 或 DELETE 的请求呢?通过 RESTful 我们可以简单 URI 来定义资源并和 HTTP 方法配合使用。
Resource 与 HTTP 方法的对应
资源
资源说明
GET
PUT
POST
DELETE
http://www.cnblogs.com/Products/
Products是一组资源集合
列出 该组资源集合中每个资源的详细信息
更新 当前整组资源
新增 或附加一个新资源。该操作传回新资源的URL
删除 整组资源
http://www.cnblogs.com/Products/1
Products/1是单个资源
取得 指定的资源的详细信息
更新 或新增指定的资源
新增 或附加一个新元素
删除 指定的元素