PHP.mk документација

Imagick::getResourceLimit

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

imagick.getresourcelimit.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека imagick.getresourcelimit.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
Imagick::getResourceLimit

Референца за `imagick.getresourcelimit.php` со подобрена типографија и навигација.

imagick.getresourcelimit.php

Imagick::getResourceLimit

(PECL imagick 2, PECL imagick 3)

Imagick::getResourceLimitReturns the specified resource limit

= NULL

public static Imagick::getResourceLimit(int $type): int

Returns the specified resource limit.

Параметри

type

вистинска функција, само прототип за тоа како треба да биде функцијата. resourcetype constants.

Вратени вредности

Returns the specified resource limit. The unit depends on the type of the resource being limited.

Errors/Exceptions

Фрла ImagickException при грешка.

Види Исто така

Белешки од корисници 1 белешка

Keisial на gmail точка com
пред 13 години
By using the PHP function getResourceLimit, you'll be given the maximum allowed amount of a particular type of resource.  The integer returned is the number of bytes allowed to the resource you specified in the input parameter.  For the input parameter options, you have the predefined ResourceType constants for the ImageMagick package.  In the code, they look like imagick::RESOURCETYPE_AREA, but you have "_VALUE" options of: undefined, area, disk, file, map, and memory.

What do each of these particular values represent?  The ImageMagick official documentation is helpful in that matter.  File indicates "maximum number of open pixel cache files", Area indicates "maximum area in bytes of any one image that can reside in the pixel cache memory", Memory indicates "maximum amount of memory in bytes to allocate for the pixel cache", map indicates "maximum amount of memory map in bytes to allocate for the pixel cache", and disk indicates "maximum amount of disk space in bytes permitted for use by the pixel cache".  This is according to the Official ImageMagick Architecture page: http://www.imagemagick.org/script/architecture.php .

The Official ImageMagick Resource page has more information on how these parameters function.  For instance, the files limit documentation mentions that when a user goes over the limit, any more files will be "cached to disk are closed and reopened on demand."  (Again, a performance hit.)  See that page here: http://www.imagemagick.org/script/resources.php .

What happens when someone exceeds their limit?  It doesn't cause the PHP script to error out, but simply, it relocates their user activity to non-cache memory (i.e.: virtual memory, which is slow).  So, even if you're worried about the limit, it really only indicates the point in a server at which a user's request is devalued compared to other user requests.

And remember, you can always set the defaults in the policy.xml file on your own server.

Some sample code :

<?php

            // Author: [email protected]
    
        // Imagick Type
        // ---------------------------------------------

    $imagick_type = new Imagick();
    
        // Open File
        // ---------------------------------------------
        
    $file_to_grab = "image_workshop_directory/test.gif";
    
    $file_handle_for_viewing_image_file = fopen($file_to_grab, 'a+');
    
        // Grab File
        // ---------------------------------------------

    $imagick_type->readImageFile($file_handle_for_viewing_image_file);
    
        // Get/Display Resource Values
        // ---------------------------------------------
    
    print("Undefined: ");
    print($imagick_type->getResourceLimit(imagick::RESOURCETYPE_UNDEFINED));

    print("<br><br>Area: ");
    print($imagick_type->getResourceLimit(imagick::RESOURCETYPE_AREA));
    
    print("<br><br>Disk: ");
    print($imagick_type->getResourceLimit(imagick::RESOURCETYPE_DISK));
    
    print("<br><br>File: ");
    print($imagick_type->getResourceLimit(imagick::RESOURCETYPE_FILE));
    
    print("<br><br>Map: ");
    print($imagick_type->getResourceLimit(imagick::RESOURCETYPE_MAP));
    
    print("<br><br>Memory: ");
    print($imagick_type->getResourceLimit(imagick::RESOURCETYPE_MEMORY));

?>
Навигација

Прелистувај сродни теми и функции.

На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.