Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draw images using data:// URIs no longer possible #1104

Closed
futape opened this issue Oct 10, 2019 · 4 comments
Closed

Draw images using data:// URIs no longer possible #1104

futape opened this issue Oct 10, 2019 · 4 comments

Comments

@futape
Copy link

futape commented Oct 10, 2019

I found this bug / would like to have this new functionality

Since mPDF 7.1.8 or since commit 20ff639 (PR #950) it's no longer possible to use a data:// URI as source of an image to draw. This is that commit fixe issue #949. Unfortunately instrad of implementing a blacklist disabling the phar:// wrapper, a whitelist only allowing http, https and file URIs as well as traditional paths has been implemented disabling any data:// URIs (as well as any other wrapper).
I would suggest changing to a blacklist strategy.

This is mPDF and PHP version and environment (server/fpm/cli etc) I am using

mPDF 7.1.8
PHP 7.0.33
Apache 2.4.18

This is a PHP code snippet I use

<?php
$mpdf = new \Mpdf\Mpdf();
$mpdf->Image('data://image/jpg;base64,<base64-encoded jpeg>');


@jakejackson1
Copy link
Contributor

You can work around this by configuring a whitelist you are comfortable with on your host when initialising mPDF: b69be38

@futape
Copy link
Author

futape commented Oct 11, 2019

Cool, thanks for your reply. This solves this issue.

@futape futape closed this as completed Oct 11, 2019
@Bohemme
Copy link

Bohemme commented Oct 20, 2022

You can work around this by configuring a whitelist you are comfortable with on your host when initialising mPDF

How can you achieve this? It has something to do with the server or the config file? I can't make it work with base64 streams. :(
Thks

@finwe
Copy link
Member

finwe commented Oct 20, 2022

@Bohemme this issue is closed and issues do not serve as general troubleshooting. Use Discussions or create a Stack Overflow question.

@mpdf mpdf locked as resolved and limited conversation to collaborators Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants