Skip to content

Commit

Permalink
Disable base64 encoding for File::dataUri #2276
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico Hoffmann committed Nov 23, 2019
1 parent 926ef33 commit 98a7204
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Toolkit/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,16 @@ public function copy(string $target, bool $force = false)
/**
* Returns the file as data uri
*
* @param bool $base64 Whether the data should be base64 encoded or not
* @return string
*/
public function dataUri(): string
public function dataUri(bool $base64 = true): string
{
return 'data:' . $this->mime() . ';base64,' . $this->base64();
if ($base64 === true) {
return 'data:' . $this->mime() . ';base64,' . $this->base64();
}

return 'data:' . $this->mime() . ',' . $this->read();
}

/**
Expand Down

0 comments on commit 98a7204

Please sign in to comment.