Dutch PHP Conference 2021 - Call for Papers


(PECL imagick 2, PECL imagick 3)

Imagick::validVérifie si l'élément courant est valide


public Imagick::valid ( ) : bool

Vérifie si l'élément courant est valide.

Valeurs de retour

Retourne true en cas de succès.

add a note add a note

User Contributed Notes 1 note

hyrumt at mediarain dot com
10 years ago
We found this method to be of value when checking most image file types. However, it does not appear to be rigorous enough to detect corrupt jpg files. We use the following for jpgs and validate() for everything else.

// check for the existence of the EOI segment header at the end of the file
if (0 !== fseek($file, -2, SEEK_END) || "\xFF\xD9" !== fread($file, 2)) {
To Top