94238a8a70b7b539b594adfc125ef9ec79b68f04
[yaffs-website] / INSTALL.md
1 # INSTALL
2
3
4 ## Requirements
5
6 PEL requires PHP version 5.
7
8
9 ## Installation
10
11 ### Composer
12
13 The preferred way of installing PEL is through composer. Simply add a
14 dependency on ´lsolesen/pel´ to your projects composer.json.
15
16     {
17         "require": {
18             "lsolesen/pel": "0.9.*"
19         }
20     }
21
22 For a system-wide installation via Composer, you can run:
23
24     composer global require "lsolesen/pel=0.9.*"
25
26
27 ### Clone via git
28
29 You can also use git to install it using:
30
31   git clone git://github.com/lsolesen/pel.git
32   git checkout <tag name>
33
34 Finally, you can install PEL by extracting it to a local directory. You can find
35 the compressed files here: https://github.com/lsolesen/pel/downloads.
36
37 Make sure that you extract the files to a path included in your include path:
38 You can set the include path using.
39
40   set_include_path('/path/to/pel' . PATH_SEPARATOR . get_include_path());
41
42
43 ## Upgrading
44
45 If you have already been using a previous version of PEL, then be sure
46 to read the CHANGELOG.md file before starting with a new version.
47
48
49 ## Using PEL
50
51 Your application should include PelJpeg.php or PelTiff.php for working
52 with JPEG or TIFF files.  The files will define the PelJpeg and
53 PelTiff classes, which can hold a JPEG or TIFF image, respectively.
54 Please see the API documentation in the doc directory or online at
55
56   http://lsolesen.github.com/pel/doc/
57
58 for the full story about those classes and all other available classes
59 in PEL.
60
61 Still, an example would be good.  The following example will load a
62 JPEG file given as a command line argument, parse the Exif data
63 within, change the image description to 'Edited by PEL', and finally
64 save the file again.  All in just six lines of code:
65
66   ```php5
67   <?php
68   require_once('PelJpeg.php');
69
70   $jpeg = new PelJpeg($argv[1]);
71   $ifd0 = $jpeg->getExif()->getTiff()->getIfd();
72   $entry = $ifd0->getEntry(PelTag::IMAGE_DESCRIPTION);
73   $entry->setValue('Edited by PEL');
74   $jpeg->saveFile($argv[1]);
75   ?>
76   ```
77
78 See the examples directory for this example (or rather a more
79 elaborate version in the file edit-description.php) and others as PHP
80 files.  You may have to adjust the path to PHP, found in the very
81 first line of the files before you can execute them.
82
83
84 ## Changing PEL
85
86 If you find a bug in PEL then please send a report back so that it can
87 be fixed in the next version.  You can submit your bugs and other
88 requests here:
89
90   http://github.com/lsolesen/pel/issues
91
92 If you change the code (to fix bugs or to implement enhancements), it
93 is highly recommended that you test your changes against known good
94 data.  Please see the test/README.md file for more information about
95 running the PEL test suite.