Permalink
Browse files

Merge branch 'master' of https://github.com/noony/ImageResizingServer

* 'master' of https://github.com/noony/ImageResizingServer:
  Update README.md
  Update README.md
  Update README.md
  • Loading branch information...
2 parents 0203ff4 + 774a1c2 commit e3bd84a9863aae1990fa0300559f8a9e2b733317 @noony committed Sep 9, 2013
Showing with 49 additions and 6 deletions.
  1. +49 −6 README.md
View
@@ -13,25 +13,44 @@ Installation
-----------
need sudo :
-
- apt-get install python-pip python-imaging nginx build-essential python-dev libxml2-dev && pip install uwsgi tornado
- cd /tmp && git clone https://github.com/noony/ImageResizingServer.git && cd ./ImageResizingServer
- python setup.py install
-
+```bash
+apt-get install python-pip python-imaging nginx build-essential python-dev libxml2-dev && pip install uwsgi tornado
+cd /tmp && git clone https://github.com/noony/ImageResizingServer.git && cd ./ImageResizingServer
+python setup.py install
+```
Attention if you haven't installed nginx you have to remove default conf in sites-enabled (rm /etc/nginx/sites-enabled/default)
-
Configuration
-----------
You have to define your image clusters. It a simple dict in server.conf
+default :
+
+ clusterInfos = {
+ }
+ signatureSecret = ""
+ timeoutGetCluster = 1
+ defaultQuality = 90
+ minHeight = 1
+ maxHeight = 2048
+ minWidth = 1
+ maxWidth = 2048
+
+
Example :
clusterInfos = {
'cluster1': 'url.cluster1.com',
'cluster2': 'url.cluster2.com'
}
+ signatureSecret = "MY_SECRET_TOKEN"
+ timeoutGetCluster = 1
+ defaultQuality = 100
+ minHeight = 1
+ maxHeight = 1024
+ minWidth = 1
+ maxWidth = 1024
You have to restart uwsgi after.
@@ -56,3 +75,27 @@ http://example.com/cluster1/crop/200x200/path/to/image.png
Crop an image and resize 200/200px and change quality to 95% :
http://example.com/cluster1/crop/95/200x200/path/to/image.png
+
+Securise your application
+-----------
+If you want to securise the application, put a token in configuration directive "signatureSecret".
+
+And after to retrieve the signature you just have to follow this example:
+
+configuration: signatureSecret="YOUR_SECRET_TOKEN"
+
+uri: /cluster1/crop/95/200x200/path/to/image.png
+
+Python :
+```python
+import hashlib
+hashlib.sha512('YOUR_SECRET_TOKEN' + '/cluster1/crop/95/200x200/path/to/image.png').hexdigest()[:4]
+result : '61b5'
+```
+PHP :
+```php
+substr(hash('sha512', 'YOUR_SECRET_TOKEN' . '/cluster1/crop/95/200x200/path/to/image.png'), 0, 4);
+result : '61b5'
+```
+
+Final uri : /61b5/cluster1/crop/95/200x200/path/to/image.png

0 comments on commit e3bd84a

Please sign in to comment.