File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 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
110122PHP-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
You can’t perform that action at this time.
0 commit comments