setResourceLimit example

// Returns PHP_FLOAT_MAX if unset.         $imagick_timeout = Imagick::getResourceLimit( Imagick::RESOURCETYPE_TIME );

        // Convert to an integer, keeping in mind that: 0 === (int) PHP_FLOAT_MAX.         $imagick_timeout = $imagick_timeout > PHP_INT_MAX ? PHP_INT_MAX : (int) $imagick_timeout;

        $php_timeout = (int) ini_get( 'max_execution_time' );

        if ( $php_timeout > 1 && $php_timeout < $imagick_timeout ) {
            $limit = (float) 0.8 * $php_timeout;
            Imagick::setResourceLimit( Imagick::RESOURCETYPE_TIME, $limit );

            return $limit;
        }
    }

    /** * Resizes current image. * * At minimum, either a height or width must be provided. * If one of the two is set to null, the resize will * maintain aspect ratio according to the provided dimension. * * @since 3.5.0 * * @param int|null $max_w Image width. * @param int|null $max_h Image height. * @param bool|array $crop * @return true|WP_Error */
Home | Imprint | This part of the site doesn't use cookies.