Ejemplo n.º 1
0
/**
 * liberty_magickwand_check_error 
 * 
 * @param array $pResult 
 * @param array $pWand 
 * @access public
 * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
 */
function liberty_magickwand_check_error($pResult, $pWand)
{
    $ret = FALSE;
    if ($pResult === FALSE && WandHasException($pWand)) {
        $ret = 'An image processing error occurred : ' . WandGetExceptionString($pWand);
    }
    return $ret;
}
Ejemplo n.º 2
0
/**
 * Function checkWandError() compares the value of $result, which should be
 * the result of any MagickWand API function, to explicit FALSE, and if it is
 * FALSE, checks if $wand for contains an error condition (in case the API
 * function is just returning FALSE as a normal return value).
 *
 * If the return value is FALSE, and the $wand contains a set error condition,
 * the function outputs the error and forcibly ends the program.
 *
 * If not, returns $result as a reference.
 *
 * @param mixed       MagickWand API function result
 * @param resource    Any MagickWand API resource
 * @param int         Always __LINE__ (script current line number predefined
 *                        PHP constant)
 *
 * @return reference  Returns reference to 1st argument (if no errors found)
 */
function &checkWandError(&$result, $wand, $line)
{
    if ($result === FALSE && WandHasException($wand)) {
        echo '<pre>An error occurred on line ', $line, ': ', WandGetExceptionString($wand), '</pre>';
        exit;
    }
    return $result;
}