PHP 8.5.0 RC 2 available for testing

Imagick::valid

(PECL imagick 2, PECL imagick 3)

Imagick::valid β€” Verifica si el elemento actual es vΓ‘lido

DescripciΓ³n

public Imagick::valid(): bool

Verifica si el elemento actual es vΓ‘lido.

ParΓ‘metros

Esta funciΓ³n no contiene ningΓΊn parΓ‘metro.

Valores devueltos

Devuelve true en caso de Γ©xito.

οΌ‹add a note

User Contributed Notes 1 note

up
0
hyrumt at mediarain dot com ΒΆ
15 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.

<?php
// 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)) {
fclose($file);
return
FALSE;
}
?>
To Top