Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Suppress Warnings From libpng

Offen
#23,674 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
55/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
c, php

Rechercherichtung

Beginne damit, die GD-Implementierung hinter imagecreatefrompng und deren Behandlung von libpng-Warnungen zu finden. Prüfe, wie die bestehende PHP GD API das Verhalten beim Laden von Bildern bereitstellt und ob zugehörige Tests Warnungen abdecken. Als abgeschlossen gilt die Bereitstellung der angeforderten Möglichkeit, libpng-Warnungen umzuschalten, einschließlich der optionalen Abfrage des Zustands, mit Testabdeckung für den bereitgestellten Fall mit einem ungültigen Profil.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Extension: gd Feature Good first issue Status: Needs Triage
Description

PNG files exported from some applications, most notably Photoshop, are written with an sRGB profile that libpng sees as invalid. Any attempt to load a file like this using the GD library causes a warning to be written to the PHP error log. It is not possible to suppress this warning.

The following code:

<?php
$image = imagecreatefrompng('clouds.png');

Results in this warning:

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

Please see the attached file as an example of one that has the issue.

The only solution I have found so far is to post-process the PNG to remove the sRGB profile. This is not ideal for workflow with large numbers of files. Whilst it is possible to disable all warnings, they are often on in production so this is not a desirable solution.

I would like a method to suppress all libpng warnings. This could be implemented as a gd_ prefixed method that takes an optional bool parameter to toggle warnings on or off. If no parameter is passed it could return the current state.

Vorherrschende Sprache
C
Sterne
40.4k
Forks
8.2k
Ø Merge
2 T. 17 Std.
Gemergte PRs (30 T.)
115

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus php/php-src

Alle Issues in php/php-src

Ähnliche Issues

Weitere Issues zu C

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.