Suppress Warnings From libpng
Nessuno ha ancora preso questa issue.
- Lingua principale
- C
- Stelle
- 40.4k
- Fork
- 8.1k
- Merge medio
- 2g 13h
- PR unite (30g)
- 96
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia individuando l’implementazione GD alla base di imagecreatefrompng e la relativa gestione degli avvisi di libpng. Verifica come l’API PHP GD esistente espone il comportamento di caricamento delle immagini e se i test correlati coprono gli avvisi. Il lavoro sarà completato quando sarà fornito il modo richiesto per attivare o disattivare gli avvisi di libpng, inclusa la possibilità opzionale di interrogare lo stato, con una copertura per il caso fornito di profilo non valido.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- c, php
- Ambito
- computer-graphics
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 55/100