Skip to content

Commit f8685a0

Browse files
committed
#reader-interface extracted usage examples into separate doc files
1 parent 72e1bf1 commit f8685a0

File tree

4 files changed

+68
-34
lines changed

4 files changed

+68
-34
lines changed

README.md

+4-31
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,20 @@ PHPExif serves as a wrapper around some native or CLI tools which access this EX
77
## Supported tools
88

99
* Native PHP functionality (exif_read_data, iptcparse)
10-
* [Exiftool](http://www.sno.phy.queensu.ca/~phil/exiftool/) adapter (wrapper for the exiftool binary)
10+
* [Exiftool](http://www.sno.phy.queensu.ca/~phil/exiftool‎) adapter (wrapper for the exiftool binary)
1111

1212
## Installation (composer)
1313

1414
```json
15-
"miljar/php-exif": "0.*"
15+
"miljar/php-exif": "~0.2"
1616
```
1717

1818

1919
## Usage
2020

21-
### Using factory method
21+
[Before v0.2.2](Resources/doc/usage_0.2.1.md)
2222

23-
```php
24-
<?php
25-
// reader with Native adapter
26-
$reader = \PHPExif\Reader::factory(\PHPExif\Reader::TYPE_NATIVE);
27-
28-
// reader with Exiftool adapter
29-
//$reader = \PHPExif\Reader::factory(\PHPExif\Reader::TYPE_EXIFTOOL);
30-
31-
$exif = $reader->read('/path/to/file');
32-
33-
echo 'Title: ' . $exif->getTitle() . PHP_EOL;
34-
```
35-
36-
### Using custom options
37-
38-
```php
39-
<?php
40-
$adapter = new \PHPExif\Reader\Adapter\Exiftool(
41-
array(
42-
'toolPath' => '/path/to/exiftool',
43-
)
44-
);
45-
$reader = new \PHPExif\Reader($adapter);
46-
47-
$exif = $reader->read('/path/to/file');
48-
49-
echo 'Title: ' . $exif->getTitle() . PHP_EOL;
50-
```
23+
[v0.2.2+](Resources/doc/usage.md)
5124

5225
## Contributing
5326

Resources/doc/usage.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## Usage ##
2+
3+
### Using factory method
4+
5+
```php
6+
<?php
7+
// reader with Native adapter
8+
$reader = \PHPExif\Reader\Reader::factory(\PHPExif\Reader\Reader::TYPE_NATIVE);
9+
10+
// reader with Exiftool adapter
11+
//$reader = \PHPExif\Reader\Reader::factory(\PHPExif\Reader\Reader::TYPE_EXIFTOOL);
12+
13+
$exif = $reader->read('/path/to/file');
14+
15+
echo 'Title: ' . $exif->getTitle() . PHP_EOL;
16+
```
17+
18+
### Using custom options
19+
20+
```php
21+
<?php
22+
$adapter = new \PHPExif\Adapter\Exiftool(
23+
array(
24+
'toolPath' => '/path/to/exiftool',
25+
)
26+
);
27+
$reader = new \PHPExif\Reader\Reader($adapter);
28+
29+
$exif = $reader->read('/path/to/file');
30+
31+
echo 'Title: ' . $exif->getTitle() . PHP_EOL;
32+
```

Resources/doc/usage_0.2.1.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## Usage ##
2+
3+
### Using factory method
4+
5+
```php
6+
<?php
7+
// reader with Native adapter
8+
$reader = \PHPExif\Reader::factory(\PHPExif\Reader::TYPE_NATIVE);
9+
10+
// reader with Exiftool adapter
11+
//$reader = \PHPExif\Reader::factory(\PHPExif\Reader::TYPE_EXIFTOOL);
12+
13+
$exif = $reader->getExifFromFile('/path/to/file');
14+
15+
echo 'Title: ' . $exif->getTitle() . PHP_EOL;
16+
```
17+
18+
### Using custom options
19+
20+
```php
21+
<?php
22+
$adapter = new \PHPExif\Reader\Adapter\Exiftool(
23+
array(
24+
'toolPath' => '/path/to/exiftool',
25+
)
26+
);
27+
$reader = new \PHPExif\Reader($adapter);
28+
29+
$exif = $reader->getExifFromFile('/path/to/file');
30+
31+
echo 'Title: ' . $exif->getTitle() . PHP_EOL;
32+
```

lib/PHPExif/Reader/Reader.php

-3
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ public function getAdapter()
7171
*/
7272
public static function factory($type)
7373
{
74-
/**
75-
* @var $result $this
76-
*/
7774
$classname = get_called_class();
7875
$adapter = null;
7976
switch ($type) {

0 commit comments

Comments
 (0)