8000 Suppress unexpected libpng warning when added a logo by louislam · Pull Request #372 · endroid/qr-code · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Suppress unexpected libpng warning when added a logo #372

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

Merged
merged 1 commit into from
May 10, 2022

Conversation

louislam
Copy link
Contributor
@louislam louislam commented May 9, 2022

PHP Version: 8.1.0

Problem:
When added some png files as a logo, it will throw a warning like this:

PHP Warning: imagecreatefromstring(): gd-png: libpng warning: iCCP: known incorrect sRGB profile

In some php frameworks, they treated it as an exception which end the program immediately and cannot generate the qr code.

Related issue:
dompdf/dompdf#2718

Reproduce:

<?php
$data = file_get_contents("https://user-images.githubusercontent.com/1336778/167459293-12d01436-33ac-432d-b8a1-fac00ef113c1.png");

// Error!!
$im = imagecreatefromstring($data);

// Fix
// $im = @imagecreatefromstring($data);

if ($im !== false) {
    echo "OK";
} else {
    echo "Not OK";
}

@endroid endroid self-assigned this May 10, 2022
@endroid endroid added the enhancement New feature or request label May 10, 2022
@endroid endroid merged commit bf087fa into endroid:master May 10, 2022
@endroid
Copy link
Owner
endroid commented May 10, 2022

Thank you @louislam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0