Skip to content

Commit c3562fa

Browse files
author
Francesco Abeni
committed
Update doc with new buildFromUrl feature
1 parent c9de086 commit c3562fa

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

docs/source/index.rst

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Dumper
8989
// Add some parameters
9090
$dataObject->addParameters('charset' => 'utf-8');
9191
92-
echo DaraURI\Dumper::dump($dataObject);
92+
echo DataURI\Dumper::dump($dataObject);
9393
// Output data:text/plain;charset=utf-8,%23%24%25
9494
9595
Dump URI from file
@@ -101,7 +101,19 @@ Dump URI from file
101101
use DataURI;
102102
103103
$dataObject = DataURI\Data::buildFromFile("/path/to/my/image.png");
104-
echo DaraURI\Dumper::dump($dataObject);
104+
echo DataURI\Dumper::dump($dataObject);
105+
// Output data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...+S/EAAAAASUVORK5CYII=
106+
107+
Dump URI from url
108+
^^^^^^^^^^^^^^^^^
109+
110+
.. code-block:: php
111+
112+
<?php
113+
use DataURI;
114+
115+
$dataObject = DataURI\Data::buildFromUrl("http://www.example.org/path/to/my/image.png");
116+
echo DataURI\Dumper::dump($dataObject);
105117
// Output data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...+S/EAAAAASUVORK5CYII=
106118
107119
Handling Exceptions
@@ -110,7 +122,7 @@ Handling Exceptions
110122
PHP-dataURI throws 4 different types of exception :
111123

112124
- ``\DataURI\Exception\FileNotFoundException`` is thrown when an invalid
113-
pathfile is supplied
125+
pathfile is supplied or when we don't get a valid response from URL
114126
- ``\DataURI\Exception\InvalidDataException`` is thrown when raw data could not
115127
be decoded
116128
- ``\DataURI\Exception\TooLongDataException`` is thrown when provided data is too

0 commit comments

Comments
 (0)