Git Product home page Git Product logo

picture's Introduction

Picture

一个图片展示网站,由以下几部分组成:

  • 存储
  • API
  • 采集
  • 展示

待办事项

完成网站存储布局

完成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认证逻辑
  • [ ] 增加回到页头按钮
  • [ ] 可抓取内容
    1. weibo外链:http://photo.weibo.com/welcome/hot

部署到sinaapp的步骤

  1. 将webpy目录拷贝为sinaapp源码的数字目录
  2. 修改const.py配置,将using_sae=False注释掉
  3. 提交代码
  4. 上传图片数据

API接口

新增

  • 文件: 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是单个资源

取得 指定的资源的详细信息

更新 或新增指定的资源

新增 或附加一个新元素

删除 指定的元素

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.