Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/daxslab/web2py-thumbnails
thumbnails plugin for the web2py framework
https://github.com/daxslab/web2py-thumbnails
Last synced: 17 days ago
JSON representation
thumbnails plugin for the web2py framework
- Host: GitHub
- URL: https://github.com/daxslab/web2py-thumbnails
- Owner: daxslab
- License: lgpl-2.1
- Created: 2014-05-14T12:55:35.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-06-26T12:58:02.000Z (over 9 years ago)
- Last Synced: 2024-07-31T20:48:01.687Z (5 months ago)
- Language: Python
- Size: 172 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- cuban-opensource - web2py-thumbnails
README
web2py-thumbnails
=================Thumbnails plugin for the web2py framework.
This plugin allows automatic creation of thumbnails from image upload fields. It creates a virtual field and not modify original tables.
Installation
============- Install or include Python Imaging Library (PIL)
- Download The plugin installer (.w2p file) and install it via the web2py interface.Usage
=====```python
# coding: utf8db = DAL()
db.define_table('mytable',Field('myfield','string'),
Field('img','upload'))from plugin_thumbnails.thumbnails import thumbnails # imports thumbnails plugin
thumb = thumbnails(db, autodelete=True) # instantiate plugin and crete thumbnails table
thumb.create(db.mytable.img, (150, 150), use_imageops=True) # create thumbnails for mytable img fielddb.mytable.insert(myfield='Char',img=image) # automatically create thumbnail for img field
db(db.mytable.id==1).update(img=new_image) # automatically update thumbnail
thumbnail = db(db.mytable).select().first().img_thumbnail # select thumbnail
db(db.mytable.id==1).delete() # automatically delete thumbnail```