<?php
bool public Imagick::valid();
?>
<?php
$img = PATH2IMGW . '/sign.png';
try {
// Create a new imagick object with invalid image
$imagick = new Imagick($img);
if ($imagick->valid()) {
echo 'Image is valid';
}
} catch (exception $e) {
echo 'Image is not valid';
}
?>
<?php
$img = PATH2IMGW . '/others/sign1.png';
try {
// Create a new imagick object with valid image
$imagick = new Imagick($img);
if ($imagick->valid()) {
echo 'Image is valid';
}
} catch (exception $e) {
echo 'Image is not valid';
}
?>
<?php
// ini_set('display_errors', 0 );
error_reporting(0);
// In another way...
// Does not display anything if the image is not valid
$img = PATH2IMGW . '/others/sign.png';
$imagick = new Imagick($img);
if ($imagick->valid())
{
echo 'Image is valid';
}
else
{
echo 'Image is not valid';
}
?>