Skip to content

Commit 038d46d

Browse files
authored
Create gh-pages branch via GitHub
1 parent f790b47 commit 038d46d

File tree

2 files changed

+122
-16
lines changed

2 files changed

+122
-16
lines changed

index.html

Lines changed: 120 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en-us">
33
<head>
44
<meta charset="UTF-8">
5-
<title>Php-vips by jcupitt</title>
5+
<title>php-vips by jcupitt</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<link rel="stylesheet" type="text/css" href="stylesheets/normalize.css" media="screen">
88
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
@@ -11,41 +11,147 @@
1111
</head>
1212
<body>
1313
<section class="page-header">
14-
<h1 class="project-name">Php-vips</h1>
14+
<h1 class="project-name">php-vips</h1>
1515
<h2 class="project-tagline">php binding for libvips</h2>
1616
<a href="https://github.com/jcupitt/php-vips" class="btn">View on GitHub</a>
1717
<a href="https://github.com/jcupitt/php-vips/zipball/master" class="btn">Download .zip</a>
1818
<a href="https://github.com/jcupitt/php-vips/tarball/master" class="btn">Download .tar.gz</a>
1919
</section>
2020

2121
<section class="main-content">
22-
<h3>
23-
<a id="welcome-to-github-pages" class="anchor" href="#welcome-to-github-pages" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Welcome to GitHub Pages.</h3>
22+
<h1>
23+
<a id="high-level-php-binding-for-libvips" class="anchor" href="#high-level-php-binding-for-libvips" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>High-level PHP binding for libvips</h1>
2424

25-
<p>This automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here <a href="https://guides.github.com/features/mastering-markdown/">using GitHub Flavored Markdown</a>, select a template crafted by a designer, and publish. After your page is generated, you can check out the new <code>gh-pages</code> branch locally. If you’re using GitHub Desktop, simply sync your repository and you’ll see the new branch.</p>
25+
<p><code>php-vips</code> is a binding for <a href="https://github.com/jcupitt/libvips">libvips</a> for
26+
PHP 7. We have a set of <a href="docs/index.html">formatted API docs</a>. </p>
27+
28+
<p>libvips is fast and needs little memory. The <a href="https://github.com/jcupitt/php-vips-bench"><code>vips-php-bench</code></a> repository tests
29+
<code>php-vips</code> against <code>imagick</code> and <code>gd</code>. On that test, and on my laptop,
30+
<code>php-vips</code> is around four times faster than <code>imagick</code> and needs 10 times less
31+
memory. </p>
32+
33+
<p>Programs that use libvips don't manipulate images directly, instead they
34+
create pipelines of image processing operations starting from a source
35+
image. When the pipe is connected to a destination, the whole pipeline
36+
executes at once and in parallel, streaming the image from source to
37+
destination in a set of small fragments.</p>
38+
39+
<p>This module builds upon the <code>vips</code> PHP extension, see:</p>
40+
41+
<p><a href="https://github.com/jcupitt/php-vips-ext">https://github.com/jcupitt/php-vips-ext</a></p>
42+
43+
<p>You'll need to install that first. It's tested on Linux and macOS ---
44+
Windows would need some work, but should be possible. </p>
45+
46+
<h3>
47+
<a id="example" class="anchor" href="#example" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Example</h3>
48+
49+
<div class="highlight highlight-text-html-php"><pre><span class="pl-s1"><span class="pl-c">#!/usr/bin/env php</span></span>
50+
<span class="pl-s1"><span class="pl-k">&lt;</span>?<span class="pl-c1">php</span></span>
51+
<span class="pl-s1"><span class="pl-k">require</span> <span class="pl-c1">__DIR__</span> <span class="pl-k">.</span> <span class="pl-s"><span class="pl-pds">'</span>/vendor/autoload.php<span class="pl-pds">'</span></span>;</span>
52+
<span class="pl-s1"><span class="pl-k">use</span> <span class="pl-c1">Jcupitt\Vips</span>;</span>
53+
<span class="pl-s1"></span>
54+
<span class="pl-s1"><span class="pl-smi">$image</span> <span class="pl-k">=</span> <span class="pl-c1">Vips\</span><span class="pl-c1">Image</span><span class="pl-k">::</span>newFromFile(<span class="pl-smi">$argv</span>[<span class="pl-c1">1</span>]);</span>
55+
<span class="pl-s1"></span>
56+
<span class="pl-s1"><span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">"</span>width = <span class="pl-pds">"</span></span>, <span class="pl-smi">$image</span><span class="pl-k">-&gt;</span><span class="pl-smi">width</span>, <span class="pl-s"><span class="pl-pds">"</span><span class="pl-cce">\n</span><span class="pl-pds">"</span></span>;</span>
57+
<span class="pl-s1"></span>
58+
<span class="pl-s1"><span class="pl-smi">$image</span> <span class="pl-k">=</span> <span class="pl-smi">$image</span><span class="pl-k">-&gt;</span>invert();</span>
59+
<span class="pl-s1"></span>
60+
<span class="pl-s1"><span class="pl-smi">$image</span><span class="pl-k">-&gt;</span>writeToFile(<span class="pl-smi">$argv</span>[<span class="pl-c1">2</span>]);</span>
61+
<span class="pl-s1"></span><span class="pl-pse"><span class="pl-s1">?</span>&gt;</span></pre></div>
62+
63+
<p>You'll need this in your <code>composer.json</code>:</p>
64+
65+
<pre><code> "require": {
66+
"jcupitt/vips" : "1.0.0"
67+
}
68+
</code></pre>
69+
70+
<p>And run with:</p>
71+
72+
<pre><code>$ composer install
73+
$ ./try1.php ~/pics/k2.jpg x.tif
74+
</code></pre>
75+
76+
<p>See <code>examples/</code>.</p>
2677

2778
<h3>
28-
<a id="designer-templates" class="anchor" href="#designer-templates" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Designer Templates</h3>
79+
<a id="introduction-to-the-api" class="anchor" href="#introduction-to-the-api" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Introduction to the API</h3>
80+
81+
<p>Almost all methods return a new image for the result, so you can chain them.
82+
For example:</p>
83+
84+
<div class="highlight highlight-text-html-php"><pre><span class="pl-s1"><span class="pl-smi">$image</span> <span class="pl-k">=</span> <span class="pl-smi">$image</span><span class="pl-k">-&gt;</span>more(<span class="pl-c1">12</span>)<span class="pl-k">-&gt;</span>ifthenelse(<span class="pl-c1">255</span>, <span class="pl-smi">$image</span>);</span></pre></div>
85+
86+
<p>will make a mask of pixels greater than 12, then use the mask to set pixels to
87+
either 255 or the original image.</p>
2988

30-
<p>We’ve crafted some handsome templates for you to use. Go ahead and click 'Continue to layouts' to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved.</p>
89+
<p>You use long, double, array and image as parameters. For example:</p>
90+
91+
<div class="highlight highlight-text-html-php"><pre><span class="pl-s1"><span class="pl-smi">$image</span> <span class="pl-k">=</span> <span class="pl-smi">$image</span><span class="pl-k">-&gt;</span>add(<span class="pl-c1">2</span>);</span></pre></div>
92+
93+
<p>to add two to every band element, or:</p>
94+
95+
<div class="highlight highlight-text-html-php"><pre><span class="pl-s1"><span class="pl-smi">$image</span> <span class="pl-k">=</span> <span class="pl-smi">$image</span><span class="pl-k">-&gt;</span>add([<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>]);</span></pre></div>
96+
97+
<p>to add 1 to the first band, 2 to the second and 3 to the third. Or:</p>
98+
99+
<div class="highlight highlight-text-html-php"><pre><span class="pl-s1"><span class="pl-smi">$image</span> <span class="pl-k">=</span> <span class="pl-smi">$image</span><span class="pl-k">-&gt;</span>add(<span class="pl-smi">$image2</span>);</span></pre></div>
100+
101+
<p>to add two images. Or: </p>
102+
103+
<div class="highlight highlight-text-html-php"><pre><span class="pl-s1"><span class="pl-smi">$image</span> <span class="pl-k">=</span> <span class="pl-smi">$image</span><span class="pl-k">-&gt;</span>add([[<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>], [<span class="pl-c1">4</span>, <span class="pl-c1">5</span>, <span class="pl-c1">6</span>]]);</span></pre></div>
104+
105+
<p>To make a 2 x 3 image from the array, then add that image to the original.</p>
106+
107+
<p>Almost all methods can take an extra final argument: an array of options.
108+
For example:</p>
109+
110+
<div class="highlight highlight-text-html-php"><pre><span class="pl-s1"><span class="pl-smi">$image</span><span class="pl-k">-&gt;</span>writeToFile(<span class="pl-s"><span class="pl-pds">"</span>fred.jpg<span class="pl-pds">"</span></span>, [<span class="pl-s"><span class="pl-pds">"</span>Q<span class="pl-pds">"</span></span> <span class="pl-k">=&gt;</span> <span class="pl-c1">90</span>]);</span></pre></div>
111+
112+
<p><code>php-vips</code> comes with full API docs, run:</p>
113+
114+
<pre><code>$ vendor/bin/phpdoc
115+
</code></pre>
116+
117+
<p>And look in <code>docs/</code>.</p>
118+
119+
<p>There are around 300 operations in the library, see the vips docs for an
120+
introduction:</p>
121+
122+
<p><a href="http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/">http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/</a></p>
31123

32124
<h3>
33-
<a id="creating-pages-manually" class="anchor" href="#creating-pages-manually" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Creating pages manually</h3>
125+
<a id="how-it-works" class="anchor" href="#how-it-works" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>How it works</h3>
126+
127+
<p>The <code>vips</code> extension defines a simple but ugly way to call any libvips
128+
operation from PHP. It uses libvips' own introspection facilities
129+
and does not depend on anything else (so no gobject-introspection,
130+
for example). It's a fairly short 1,600 lines of C.</p>
34131

35-
<p>If you prefer to not use the automatic generator, push a branch named <code>gh-pages</code> to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.</p>
132+
<p>This module is a PHP layer over the ugly <code>vips</code> extension that
133+
tries to make a nice interface for programmers. It uses <code>__call()</code> and
134+
<code>__get()</code> to make all libvips operations appear as methods, and all
135+
libvips properties as properties of the PHP <code>Vips\Image</code> class.</p>
36136

37137
<h3>
38-
<a id="authors-and-contributors" class="anchor" href="#authors-and-contributors" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Authors and Contributors</h3>
138+
<a id="test-and-install" class="anchor" href="#test-and-install" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Test and install</h3>
39139

40-
<p>You can @mention a GitHub username to generate a link to their profile. The resulting <code>&lt;a&gt;</code> element will link to the contributor’s GitHub Profile. For example: In 2007, Chris Wanstrath (<a href="https://github.com/defunkt" class="user-mention">@defunkt</a>), PJ Hyett (<a href="https://github.com/pjhyett" class="user-mention">@pjhyett</a>), and Tom Preston-Werner (<a href="https://github.com/mojombo" class="user-mention">@mojombo</a>) founded GitHub.</p>
140+
<pre><code>$ phpcs --standard=PSR2 src
141+
$ php ~/packages/php/composer.phar install
142+
$ vendor/bin/phpunit
143+
$ vendor/bin/phpdoc
144+
</code></pre>
41145

42146
<h3>
43-
<a id="support-or-contact" class="anchor" href="#support-or-contact" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Support or Contact</h3>
147+
<a id="regenerate-auto-docs" class="anchor" href="#regenerate-auto-docs" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Regenerate auto docs</h3>
44148

45-
<p>Having trouble with Pages? Check out our <a href="https://help.github.com/pages">documentation</a> or <a href="https://github.com/contact">contact support</a> and we’ll help you sort it out.</p>
149+
<pre><code>$ cd src
150+
$ ../examples/generate_phpdoc.rb
151+
</code></pre>
46152

47153
<footer class="site-footer">
48-
<span class="site-footer-owner"><a href="https://github.com/jcupitt/php-vips">Php-vips</a> is maintained by <a href="https://github.com/jcupitt">jcupitt</a>.</span>
154+
<span class="site-footer-owner"><a href="https://github.com/jcupitt/php-vips">php-vips</a> is maintained by <a href="https://github.com/jcupitt">jcupitt</a>.</span>
49155

50156
<span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a> using the <a href="https://github.com/jasonlong/cayman-theme">Cayman theme</a> by <a href="https://twitter.com/jasonlong">Jason Long</a>.</span>
51157
</footer>

params.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "Php-vips",
2+
"name": "php-vips",
33
"tagline": "php binding for libvips",
4-
"body": "### Welcome to GitHub Pages.\r\nThis automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here [using GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/), select a template crafted by a designer, and publish. After your page is generated, you can check out the new `gh-pages` branch locally. If you’re using GitHub Desktop, simply sync your repository and you’ll see the new branch.\r\n\r\n### Designer Templates\r\nWe’ve crafted some handsome templates for you to use. Go ahead and click 'Continue to layouts' to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved.\r\n\r\n### Creating pages manually\r\nIf you prefer to not use the automatic generator, push a branch named `gh-pages` to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.\r\n\r\n### Authors and Contributors\r\nYou can @mention a GitHub username to generate a link to their profile. The resulting `<a>` element will link to the contributor’s GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.\r\n\r\n### Support or Contact\r\nHaving trouble with Pages? Check out our [documentation](https://help.github.com/pages) or [contact support](https://github.com/contact) and we’ll help you sort it out.\r\n",
4+
"body": "# High-level PHP binding for libvips \r\n\r\n`php-vips` is a binding for [libvips](https://github.com/jcupitt/libvips) for\r\nPHP 7. We have a set of [formatted API docs](docs/index.html). \r\n\r\nlibvips is fast and needs little memory. The [`vips-php-bench`](\r\nhttps://github.com/jcupitt/php-vips-bench) repository tests\r\n`php-vips` against `imagick` and `gd`. On that test, and on my laptop,\r\n`php-vips` is around four times faster than `imagick` and needs 10 times less\r\nmemory. \r\n\r\nPrograms that use libvips don't manipulate images directly, instead they\r\ncreate pipelines of image processing operations starting from a source\r\nimage. When the pipe is connected to a destination, the whole pipeline\r\nexecutes at once and in parallel, streaming the image from source to\r\ndestination in a set of small fragments.\r\n\r\nThis module builds upon the `vips` PHP extension, see:\r\n\r\nhttps://github.com/jcupitt/php-vips-ext\r\n\r\nYou'll need to install that first. It's tested on Linux and macOS --- \r\nWindows would need some work, but should be possible. \r\n\r\n### Example\r\n\r\n```php\r\n#!/usr/bin/env php\r\n<?php\r\nrequire __DIR__ . '/vendor/autoload.php';\r\nuse Jcupitt\\Vips;\r\n\r\n$image = Vips\\Image::newFromFile($argv[1]);\r\n\r\necho \"width = \", $image->width, \"\\n\";\r\n\r\n$image = $image->invert();\r\n\r\n$image->writeToFile($argv[2]);\r\n?>\r\n```\r\n\r\nYou'll need this in your `composer.json`:\r\n\r\n```\r\n \"require\": {\r\n \"jcupitt/vips\" : \"1.0.0\"\r\n }\r\n```\r\n\r\nAnd run with:\r\n\r\n```\r\n$ composer install\r\n$ ./try1.php ~/pics/k2.jpg x.tif\r\n```\r\n\r\nSee `examples/`.\r\n\r\n### Introduction to the API\r\n\r\nAlmost all methods return a new image for the result, so you can chain them.\r\nFor example:\r\n\r\n```php\r\n$image = $image->more(12)->ifthenelse(255, $image);\r\n```\r\n\r\nwill make a mask of pixels greater than 12, then use the mask to set pixels to\r\neither 255 or the original image.\r\n\r\nYou use long, double, array and image as parameters. For example:\r\n\r\n```php\r\n$image = $image->add(2);\r\n```\r\n\r\nto add two to every band element, or:\r\n\r\n```php\r\n$image = $image->add([1, 2, 3]);\r\n```\r\n\r\nto add 1 to the first band, 2 to the second and 3 to the third. Or:\r\n\r\n```php\r\n$image = $image->add($image2);\r\n```\r\n\r\nto add two images. Or: \r\n\r\n```php\r\n$image = $image->add([[1, 2, 3], [4, 5, 6]]);\r\n```\r\n\r\nTo make a 2 x 3 image from the array, then add that image to the original.\r\n\r\nAlmost all methods can take an extra final argument: an array of options.\r\nFor example:\r\n\r\n```php\r\n$image->writeToFile(\"fred.jpg\", [\"Q\" => 90]);\r\n```\r\n\r\n`php-vips` comes with full API docs, run:\r\n\r\n```\r\n$ vendor/bin/phpdoc\r\n```\r\n\r\nAnd look in `docs/`.\r\n\r\nThere are around 300 operations in the library, see the vips docs for an\r\nintroduction:\r\n\r\nhttp://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/\r\n\r\n### How it works\r\n\r\nThe `vips` extension defines a simple but ugly way to call any libvips\r\noperation from PHP. It uses libvips' own introspection facilities\r\nand does not depend on anything else (so no gobject-introspection,\r\nfor example). It's a fairly short 1,600 lines of C.\r\n\r\nThis module is a PHP layer over the ugly `vips` extension that\r\ntries to make a nice interface for programmers. It uses `__call()` and\r\n`__get()` to make all libvips operations appear as methods, and all\r\nlibvips properties as properties of the PHP `Vips\\Image` class.\r\n\r\n### Test and install\r\n\r\n```\r\n$ phpcs --standard=PSR2 src\r\n$ php ~/packages/php/composer.phar install\r\n$ vendor/bin/phpunit\r\n$ vendor/bin/phpdoc\r\n```\r\n\r\n### Regenerate auto docs\r\n\r\n```\r\n$ cd src\r\n$ ../examples/generate_phpdoc.rb\r\n```\r\n\r\n",
55
"note": "Don't delete this file! It's used internally to help with page regeneration."
66
}

0 commit comments

Comments
 (0)