文字

Imagick::valid

(PECL imagick 2.0.0)

Imagick::validChecks if the current item is valid

说明

bool Imagick::valid ( void )

Checks if the current item is valid.

返回值

成功时返回 TRUE

用户评论:

[#1] hyrumt at mediarain dot com [2010-02-11 11:01:21]

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 (!== fseek($file, -2SEEK_END) || "\xFF\xD9" !== fread($file2)) {
        
fclose($file);
        return 
FALSE;
    }
?>

上一篇: 下一篇: