Skip to content

Commit 69bf1a7

Browse files
committed
New example.
1 parent 97f2fd9 commit 69bf1a7

File tree

6 files changed

+29
-0
lines changed

6 files changed

+29
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
exports.install = function() {
2+
F.route('/');
3+
F.resize('/img/*.png', '50%');
4+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var PngQuant = require('pngquant');
2+
3+
Image.middleware('png', function() {
4+
return new PngQuant([128]);
5+
});

image-middleware-pngquant/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('total.js').http('debug');
4.28 KB
Loading

image-middleware-pngquant/readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- total.js +v1.9.7
2+
- you must have installed GraphicsMagick or ImageMagick
3+
- install `npm install -g pngquant`
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@{layout('')}
2+
<!DOCTYPE html>
3+
<html>
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta http-equiv="X-UA-Compatible" content="IE=11" />
7+
<meta name="format-detection" content="telephone=no" />
8+
<meta name="viewport" content="width=device-width, initial-scale=1" />
9+
<meta name="robots" content="all,follow" />
10+
</head>
11+
<body style="font: normal normal 12px Arial">
12+
<div>The image is resized about 50% and shrinked with PNGQUANT. Try to remove the middleware with PNGQUANT and watch the file size.</div>
13+
<br />
14+
<div><img src="/img/logo.png" alt="Logo" /></div>
15+
</body>
16+
</html>

0 commit comments

Comments
 (0)